Determining whether the reproduced -js array has an array determines whether duplicate values duplicate values js

Js array is determined whether or not duplicate values

 

The old method can be solved by recycling, many online, here says a new way es6 implemented using the data type Set

ARR = var [1,2,3,4,5,2,3]; 
IF (.! (the Set new new (ARR)) = arr.length size) { 
    Alert ( "duplicate values array") 
}

Set specific usage can refer to the documentation Ruan Yifeng large es6 God. Portal  Set 

The old method can be solved by recycling, many online, here says a new way es6 implemented using the data type Set

ARR = var [1,2,3,4,5,2,3]; 
IF (.! (the Set new new (ARR)) = arr.length size) { 
    Alert ( "duplicate values array") 
}

Set specific usage can refer to the documentation Ruan Yifeng large es6 God. Portal  Set 

Guess you like

Origin www.cnblogs.com/mailaidedt/p/12583860.html