Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript check for duplicates in array

function checkIfDuplicateExists(w){
    return new Set(w).size !== w.length 
}

console.log(
    checkIfDuplicateExists(["a", "b", "c", "a"])
// true
);

console.log(
    checkIfDuplicateExists(["a", "b", "c"]))
//false
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #check #duplicates #array
ADD COMMENT
Topic
Name
5+3 =