ES5 新特性

  • Trailing commas are ok 尾部逗号
  • No reserved words for property names 属性名称无保留关键字
  • NaN, Infinity, undefined : are all constants 这三个 NaN, Infinity, undefined 全部是常量
  • parseInt() defaults to radix 10 这个函数 parseInt() 默认基于 10 进制
  • /regexp/ produces new reg ex object every time 正则表达式 /regexp/ 每次都创建一个新的 ex 对象
  • JSON.parse(), JSON.stringify() 加入了 JSON.parse()、JSON.stringify() 对象
  • Function.prototype.bind 加入了 bind 函数
  • String.prototype.trim 加入了 trim 函数
  • Array.prototype.every, filter, forEach, indexOf, lastIndexOf, map, reduce, reduceRight, some, 这个 Array 数组加入了几个新的方法
  • Date.now() 日期函数加入 now 方法
  • Date.prototype.toISOString
  • new Date(string) and Date.parse(string) will try ISO format 1st 日期默认按照 ISO 格式
  • Array.isArray() 加入是否是数组的判断
  • Object.keys(), Object.create(), Object.defineProperty, Object.defineProperties, 这个 Object 对象加入定义属性,创建,列举 keys 的方法 Object.getOwnPropertyDescriptor(), Object.getOwnPropertyNames(obj), Object.getPrototypeOf(obj)
  • Object.seal(), Object.freeze(), Object.preventExtensions(), Object.isSealed(), Object.isFrozen(), Object.isExtensible()
  • Property attributes: writeable, value, enumerable, configurable, get, set 这个属性支持可配置

  • 'use strict'; 加入严格模式

  • Strict Mode:

New features of ES5 summarized

results matching ""

    No results matching ""