Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to compare elements in an array

for (let i = 0; i < a.length; i++) {
    for (let k = i + 1; k < a.length; k++) {
        if (a[i] != a[k]) {
            //do stuff
        }
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #compare #elements #array
ADD COMMENT
Topic
Name
4+3 =