開発環境
- OS X Mavericks - Apple(OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Safari、Firefox + Firebug (Webプラウザ、プラグイン)
- JavaScript (プログラミング言語)
- jQuery (JavaScript Library)
Head First JavaScript ―頭とからだで覚えるJavaScriptの基本( Michael Morrison (著), 豊福 剛 (翻訳)、オライリージャパン)の9章(データを活気づける)、自分で考えてみよう(p.437)を解いてみる。
その他参考書籍
自分で考えてみよう(p.437)
コード(BBEdit)
sample.js
var Blog = function (date, body) {
this.date = date;
this.body = body;
},
random_blog = $('#random_blog'),
randomBlog = function () {
var entry = blog[Math.floor(Math.random() * blog.length)],
date = entry.date;
$('#pre0').html('[' + date.getMonth() + 1 + '/' + date.getDate() +
'/' + date.getFullYear() + ']' + entry.body);
},
blog = [new Blog(new Date('08/14/2008'), '注文'),
new Blog(new Date('08/19/2008'), '新しい'),
new Blog(new Date('08/16/2008'), '新しい'),
new Blog(new Date('08/12/2008'), 'ネット')];
randomBlog();
0 コメント:
コメントを投稿