- 发布时间
es6常用API
- 作者

- Name
- wenjuGao
- github
- @Github
Array
- Array.prototype.concat():合并数组
- Array.prototype.filter():返回过滤后的新数组
- Array.prototype.map():返回新数组
- Array.prototype.reverse():翻转数组
- Array.prototype.flat():按照一个可指定的深度递归遍历数组,并将所有元素与遍历到的子数组中的元素合并为一个新数组返回。
- Array.prototype.reduce():为数组中的每一个元素依次执行callback函数,不包括数组中被删除或从未被赋值的元素
;[0, 1, 2, 3, 4].reduce(function (accumulator, currentValue, currentIndex, array) {
// accumulator 累计器- 累计回调的返回值
// currentValue 当前值
// currentIndex 当前索引
// array 数组
return accumulator + currentValue
})
Object
- Object.assign:合并对象
- Object.keys:对象建数组
- Object.is :判断两个值是否为同一个值
语法
- 展开语法:合并对象或者数组
- 结构赋值
- 箭头函数:this指向上层作用域
异步
- Promise:then、catch、finally
迭代
Iterator
for...of...
Symbol
Set、WeakSet
Map、WeakMap WeakMap只接收除null以外的对象作为key,且key为弱引用即如果作为key的对应在其执行环境中无其他引用则key会被回收,回收后weakMap对象也自动删除其key-value