Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to compare two arrays javascript

function arraysAreIdentical(arr1, arr2){
    if (arr1.length !== arr2.length) return false;
    for (var i = 0, len = arr1.length; i < len; i++){
        if (arr1[i] !== arr2[i]){
            return false;
        }
    }
    return true; 
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #compare #arrays #javascript
ADD COMMENT
Topic
Name
1+9 =