HLJ 发布于
2020-04-28 14:25:10

使用扩展运算符(...)将Map 转为数组

使用扩展运算符(...) 函数将Map 转为数组

const map = new Map()
.set('a', 'good')
.set('b', '1230')
.set('c', '.com');

console.log(map)  
// Map(3) {"a" => "good", "b" => "1230", "c" => ".com"}

console.log([...map]); 
// [["a","good"],["b","1230"],["c",".com"]]
当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2020-04-28/517.html
最后生成于 2023-06-27 21:37:18
此内容有帮助 ?
0