開発環境
- macOS Sierra - Apple (OS)
- Emacs (Text Editor)
- JavaScript (プログラミング言語)
- Safari(Web browser)
Head First JavaScript Programming (Eric T. Freeman (著)、Elisabeth Robson (著)、O'Reilly Media)の Chapter 2.(Going further - Writing Real Code)、How the while loop works の SHARPEN YOUR PENCIL(No. 1332) を取り組んでみる。
SHARPEN YOUR PENCIL(No. 1332)
コード(Emacs)
JavaScript
let location1 = 3, location2 = 2, location3 = 5, guess, hits = 0, guesses = 0, isSunk = false; while (isSunk === false) { guess = prompt('Ready, aim, fire! (enter number from 0-6):'); if (guess === location1 || guess === location2 || guess === location3) { hits += 1; } }
0 コメント:
コメントを投稿