Distinct array of variable
This question already has an answer here:
This might help (Unique values in an array). This answer is from above link
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
usage example:
var a = ['a', 1, 'a', 2, '1'];
var unique = a.filter( onlyUnique ); // returns ['a', 1, 2, '1']
链接地址: http://www.djcxy.com/p/37746.html
上一篇: .pull`给香草JS?
下一篇: 不同的变量数组