标签:sar script isa nod mingw 结果 去重 rip from
var arr = [1,2,3,4,5,5,5,5,5,‘5‘] var arrr = [...new Set(arr)] console.log(arrr)
转成js后
‘use strict‘; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { rr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } var arr = [1, 2, 3, 4, 5, 5, 5, 5, 5, ‘5‘]; var arrr = [].concat(_toConsumableArray(new Set(arr))); console.log(arrr);
执行结果:
// 99758@zsh MINGW64 ~/Desktop // $ node test.js // [ 1, 2, 3, 4, 5, ‘5‘ ]
标签:sar script isa nod mingw 结果 去重 rip from
原文地址:http://www.cnblogs.com/zhouxiaohouer/p/7905263.html