Add method to Array to check if it contains a value - Node.js Array

Node.js examples for Array:Add Element

Description

Add method to Array to check if it contains a value

Demo Code


Array.prototype.contains = function (value){
    return this.indexOf(value)>=0
};

Related Tutorials