開発環境
- OS X Mavericks - Apple(OS)
- Safari, Firefox + Firebug, Google Chrome(Webプラウザ、プラグイン)
- BBEdit - Bare Bones Software, Inc. (GUI) , Emacs (CUI) (Text Editor)
- JavaScript (プログラミング言語)
Head First JavaScript Programming (Eric T. Freeman (著)、 Elisabeth Robson (著)、 O'Reilly Media )のChapter 1(A Quick Dip into Javascript: Getting your feet wet)、SHARPEN YOUR PENCIL(p.16)を解いてみる。
SHARPEN YOUR PENCIL(p.16)
コード(BBEdit, Emacs)
var result = '', temp = 10, color1 = 'pink', color2 = 'orange', name = 'Martha', yourLevel1 = 2, yourLevel2 = 5, yourLevel3 = 7, level = 5, points = 30000, bonus = 3300; result += ((9 / 5) * temp + 32) + ' // 50\n'; result += (color1 === 'orange') + ' // false\n'; result += (color2 === 'orange') + ' // true\n'; result += (name + ', ' + "you've won!") + " // Martha, you've won!\n"; result += (yourLevel1 > 5) + ' // false\n'; result += (yourLevel2 > 5) + ' // false\n'; result += (yourLevel3 > 5) + ' // true\n'; result += ((level * points) + bonus) + ' // 153300\n'; result += (color1 !== 'orange') + ' // true\n'; result += (1000 + '108') + ' // 1000108\n'; print(result);
0 コメント:
コメントを投稿