Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to check if object exists in array javascript

function containsObject(obj, list) {
    var i;
    for (i = 0; i < list.length; i++) {
        if (list[i] === obj) {
            return true;
        }
    }

    return false;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #object #exists #array #javascript
ADD COMMENT
Topic
Name
5+4 =