![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ES6
正版蜀黍
文章纯属个人笔记,如有错误,望请纠正~(如有侵权,请联系删除)
展开
-
ES6-数组中的of()方法
定义 Array.of()方法用于将一组数据转化为数组 语法 Array.of(element0[ , element1,[, …elementN] ]) 参数 参数可以是任意多个,将按顺序成为数组中的元素 返回值 新的数组实例 例子 Array.of(1); // [1] Array.of(1, 2, 3); // [1, 2, 3] Array.of(undefined); // [undefine原创 2020-09-09 13:14:18 · 519 阅读 · 0 评论 -
ES6-数组中的from()方法
定义 该方法用于将两类对象转换成真正的数组:类似数组的对象 和 可遍历对象; 语法 Array.from( arrayLike, mapFun, thisArg ); 参数 arrayLike:必需。想要转换成数组的伪数组对象或可迭代对象; mapFun:可选。如果指定了该参数,新数组中的每个元素会执行该回调函数。 thisArg:可选。执行回调函数mapFun时this对象。 返回值 一个新的数组实例 使用(例子) 从 String 生成数组 Array.from('foo'); /原创 2020-08-30 15:30:36 · 1155 阅读 · 0 评论 -
ES6-数组实例的includes()方法
Array.prototype.includes() 定义 用来判断一个数组中是否包含一个指定的值,如果包含则返回true,否则返回false; 语法 arrayObject.includes(valueToFind [, fromIndex ]) 参数 arrayObject:被查找的数组对象; valueToFind:需要查找的某个元素值; fromIndex:可选。从fromIndex 索引处开始查找 valueToFind。如果为负值,则按升序从 array.length + fromI原创 2020-08-28 16:25:02 · 2887 阅读 · 0 评论