内容へ移動
Cat Paw Software
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
javascript:harmony
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== ECMAScript Harmony ====== ECMAScript 6th Editionのこと ===== 追加メソッド ===== 追加されるかもしれないメソッド ==== Object.is ==== 2つの値が等しいか判定。===とほぼ同じだが、NaNと0の扱いが異なる <code javascript> if (!Object.is) { Object.is = function(v1, v2) { if (v1 === 0 && v2 === 0) return 1 / v1 === 1 / v2; if (v1 !== v1) return v2 !== v2; return v1 === v2; }; } </code> ==== Number .isInteger ===== 値が整数かどうか判定。 <code javascript> if (!Number.isInteger) { Number.isInteger = function isInteger (nVal) { return typeof nVal === "number" && isFinite(nVal) && nVal > -9007199254740992 && nVal < 9007199254740992 && Math.floor(nVal) === nVal; }; } </code> ==== String.prototype.startsWith ==== <code javascript> String.prototype.startsWith = function(s) { return this.indexOf(s) === 0; }; </code> ==== String.prototype.endsWith ==== <code javascript> String.prototype.endsWith = function(s) { var t = String(s); var index = this.lastIndexOf(t); return index >= 0 && index === this.length - t.length; }; </code> ==== String.prototype.contains ==== <code javascript> String.prototype.contains = function(s) { return this.indexOf(s) !== -1; }; </code> ==== String.prototype.toArray ==== <code javascript> String.prototype.toArray = function() { return this.split(''); }; </code>
javascript/harmony.txt
· 最終更新:
2013/07/11 08:42
by
nullpon
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ