what is new in ES5?

Object/array literal extensions

Getter accessors
Setter accessors
Trailing commas in object literals
Trailing commas in array literals
Reserved words as property names

Object static methods

Object.create()
Object.defineProperty()
Object.defineProperties()
Object.getPrototypeOf()
Object.keys()
Object.seal()
Object.freeze()
Object.preventExtensions()
Object.isSealed()
Object.isFrozen()
Object.isExtensible()
Object.getOwnPropertyDescriptor()
Object.getOwnPropertyNames()

Array methods

Array.isArray()
Array.prototype.indexOf()
Array.prototype.lastIndexOf()
Array.prototype.every()
Array.prototype.some()
Array.prototype.forEach()
Array.prototype.map()
Array.prototype.filter()
Array.prototype.reduce()
Array.prototype.reduceRight()

String properties and methods

Property access on strings
String.prototype.trim()

Date methods

Date.prototype.toISOString()
Date.now()
Date.prototype.toJSON()

Function.prototype.bind()

JSON

Immutable globals

undefined
NaN
Infinity

Miscellaneous

Array.prototype.sort: compareFn must be function or undefined
Array.prototype.sort: compareFn may be explicit undefined
Function.prototype.apply permits array-likes
parseInt ignores leading zeros
Function "prototype" property is non-enumerable
Arguments toStringTag is "Arguments"
Zero-width chars in identifiers
Unreserved words
Enumerable properties can be shadowed by non-enumerables
Thrown functions have proper "this" values

Strict mode

reserved words
"this" is undefined in functions
"this" is not coerced to object in primitive methods
"this" is not coerced to object in primitive accessors
legacy octal is a SyntaxError
assignment to unresolvable identifiers is a ReferenceError
assignment to eval or arguments is a SyntaxError
assignment to non-writable properties is a TypeError
eval or arguments bindings is a SyntaxError
arguments.caller removed or is a TypeError
arguments.callee is a TypeError
(function(){}).caller and (function(){}).arguments is a TypeError
arguments is unmapped
eval() can't create bindings
deleting bindings is a SyntaxError
deleting non-configurable properties is a TypeError
"with" is a SyntaxError
repeated parameter names is a SyntaxError
function expressions with matching name and argument are valid

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容