
Array.from() 方法从一个类似数组或可迭代对象创建一个新的,浅拷贝的数组实例。
语法
Array.from(arrayLike[, mapFn[, thisArg]])
arryLike:想要转换成数组的伪数组或可迭代对象。
mapFn(可选):如果指定了该参数,新数组中的每个元素会执行该回调函数。
thisArg(可选):可选参数,执行回调函数mapFn时this对象。
返回值:一个新的数组实例。
例子:字符串生成数组
Array.from('hello')
生成数组:['h','e','l','l','o']