Array.from

Array.from()


更多数组的操作参考 https://note.v2ee.cn/article?pid=10-1 

将类数组(arguments)和可遍历的对象(Set、Map)转化为数组

// arguments
function a(){
    console.log(Array.from(arguments)); 
}
a('a','ss','dd'); // ['a','ss','dd']

// Set
let set = new Set([1, 3, 3, 4, 4, 6]);
console.log(Array.from(set)); // [1, 3, 4, 6]

更多数组的操作参考 https://note.v2ee.cn/article?pid=10-1 

发布了29 篇原创文章 · 获赞 1 · 访问量 1376

猜你喜欢

转载自blog.csdn.net/trfdzw/article/details/81676758