javascript:harmony
文書の過去の版を表示しています。
目次
ECMAScript Harmony
ECMAScript 6th Editionのこと
追加メソッド
追加されるかもしれないメソッド
Object.is
2つの値が等しいか判定
Number .isInteger
値が整数かどうか判定。
if (!Number.isInteger) { Number.isInteger = function isInteger (nVal) { return typeof nVal === "number" && isFinite(nVal) && nVal > -9007199254740992 && nVal < 9007199254740992 && Math.floor(nVal) === nVal; }; }
String.prototype.startsWith
String.prototype.startsWith = function(s) { return this.indexOf(s) === 0; };
String.prototype.endsWith
String.prototype.endsWith = function(s) { var t = String(s); var index = this.lastIndexOf(t); return index >= 0 && index === this.length - t.length; };
String.prototype.contains
String.prototype.contains = function(s) { return this.indexOf(s) !== -1; };
String.prototype.toArray
String.prototype.toArray = function() { return this.split(''); };
javascript/harmony.1373531814.txt.gz · 最終更新: 2013/07/11 08:36 by nullpon