開発環境
- 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 5(Understanding Objects: A trip to Objectville)、BE THE BROWSER(p.203)を解いてみる。
BE THE BROWSER(p.203)
コード(BBEdit, Emacs)
var song = {
name: 'Walk This Way',
artist: 'Run-D.M.C',
minutes: 4,
seconds: 3,
genre: '80s',
playing: false,
play: function () {
if (!this.playing) {
this.playing = true;
print('Playing ' + this.name + ' by ' + this.artist);
}
},
pause: function () {
if (this.playing) {
this.playing = false;
}
}
};
song.play();
song.pause();
0 コメント:
コメントを投稿