JavaScript のグローバル変数とグローバルオブジェクト Webブラウザ上では window はグローバル変数だ。 そのプロパティは全てグローバル変数だ。 この window というグローバル変数は特別なオブジェクトでグローバルオブジェクトと呼ばれる。 var a = []; for (var i in window) { if (window[i] === window) { a.push(i); } } console.log(a.join(', '));
JavaScript のグローバル変数とグローバルオブジェクト Webブラウザ上では window はグローバル変数だ。 そのプロパティは全てグローバル変数だ。 この window というグローバル変数は特別なオブジェクトでグローバルオブジェクトと呼ばれる。 var a = []; for (var i in window) { if (window[i] === window) { a.push(i); } } console.log(a.join(', '));
JavaScript (Node.js) で開発する上で避けては通れない 非同期処理、コールバックについて考えてみたい。 自分なりのお勧めの方式を書いてみた。 いろいろなものを試した結果である。 ※この記事でのお勧めの方法は ES2015 (ES6) で実装された generators (yield) の技術を使用しています。 実はまだ Babel(6to5) 等を利用するか Node.js v4~v8 でしか 実質的に使用できない技術だと思います。悪しからず。 (早く全てのブラウザに広く普及する事を祈っています) まだブラウザでは独自ライブラリか Promise (Deferred) 等を使っています。 ※2015/10/15: 記事の内容を npm aa (async-await) に対応させました。 ※2015/04/19: 記事の内容を npm co@4 に対応させました。 ※20
JavaScript のオブジェクト作成においてクラス定義で継承を実装する方法はいくつかあります。 正しい継承はどうあるべきか、基本から検証しながら考えてみたいと思います。 ※正しくクラス定義がエコ楽にできる様に追加記事書きました。 [JavaScript] getter/setterも使えるエコ楽なクラス定義 - もちろん継承も - private変数も 一番簡単なオブジェクトの作成方法 典型的な JavaScript のオブジェクトを簡単に作成してみて、それらを確認してみましょう。 var obj1 = {x: 12, y: "ab"}; var obj2 = new Object; // または new Object() obj2.x = 34; obj2.y = "cd"; // obj < Object var obj3 = [12, "ab"]; var obj4 = new
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く