JS常用方法

数组方法:在Array.prototype中定义

ECMAScript3: 12个

  1. join
  2. reverse
  3. sort
  4. concat
  5. slice
  6. splice
  7. push\pop
  8. unshift\shift
  9. toString\toLocaleString 区别在于new Date( ) “Thu Dec 14 2017 11:35:15 GMT+0800 (CST)” / “2017/12/14 上午11:35:15”

ECMAScript5: 10个

  1. forEach
  2. map
  3. filter
  4. every\some
  5. reduce\reduceRight
  6. indexOf\lastIndexOf
  7. Array.isArray( )8

ECMAScript6: 6个

  1. Array.from
  2. Array.of
  3. copyWithin
  4. find
  5. findIndex
  6. fill

ECMAScript7: 1个

  1. includes

字符串方法:在String.prototype中定义

ECMAScript3: 8个

  1. split
  2. slice
  3. substring
  4. substr
  5. concat
  6. indexOf
  7. lastIndexOf
  8. charAt

ECMAScript5: 1个

  1. trim

ECMAScript6: 8个

  1. includes
  2. startsWith
  3. endsWith
  4. at
  5. repeat
  6. padStart\padEnd
  7. 字符串模板

对象方法:在Object.prototype中定义

ECMAScript3:

ECMAScript5:

  1. Object.isFrozen
  2. Object.freeze
  3. Object.seal
  4. Object.isSealed
  5. Object.isExtensible
  6. Object.preventExtensions
  7. Object.getOwnPropertyNames
  8. Object.getOwnPropertyDescriptor
  9. Object.defineProperties
  10. Object.defineProperty
  11. Object.create

ECMAScript6:

  1. Object.is
  2. Object.assign
  3. Object.setPrototypeOf()
  4. Object.getPrototypeOf()

迭代的方法:

  1. Object.keys
  2. Object.values
  3. Object.entries
  4. for….of
  5. for….in