【es6】es6使用集锦
一、查找数组中是否包含某个元素 使用includes ,返回值为布尔值
arr.includes(searchElement, fromIndex);
解析:searchElement 查询元素
fromIndex 开始查找的索引位置
demo:
[2, 9, 7, 8, 9].includes(9); //true
二、合并对象 使用Object.assign()
语法: Object.assign(target, …sources) target: 目标对象,sources: 源对象
作者:smile.轉角
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
欢迎关注我,一起进步!扫描下方二维码即可加我QQ