Autify CEO 近澤 良の個人ブログです。

console.log(+[]); // 0 console.log(+[3]); // 3 console.log(+[null]); // 0 console.log(+[undefined]); // 0 console.log(+["3"]); // 3 console.log(+[1,2]); // NaN console.log(+[true]); // NaN console.log(+[false]); // NaN なぜこのような処理になるのか、JavaScriptの仕様書(ECMA Script Specification 5th)から説明してみましょう。 まず最初、単項+演算子(Unary + Operator)を評価する際に、ToNumberを呼び出すのは前述したとおりです。仕様書の(11.4.6)に書かれています。ではToNumberとはどのような処理でしょうか。
I am quite excited about ECMAScript 6, after watching David Herman’s talk at YUIConf 2011. I am especially looking forward to seeing some of these features landing up on V8 soon, so that I can use it on node.js. These additions will solve many common sources of frustration that newcomers face when working with JavaScript. Although the spec is not expected to be finalized till 2013 (so says David i
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く