【发布时间】:2014-10-10 23:05:33
【问题描述】:
我想扫描一个 JS 数组并确定是否所有元素都是唯一的,或者该数组是否包含重复项。
例子:
my_array1 = [1, 2, 3]
my_array2 = [1, 1, 1]
我想得到这样的结果:
my_array1 must be return true, because this array element is unique
and array2 must be return false, because this array element is not unique
我该如何编写这个方法?
【问题讨论】:
-
似乎还有很多其他问题可以帮助您,您是否搜索过其他问题? stackoverflow.com/questions/5381621/…
标签: javascript jquery arrays