Is array has a value - Node.js Array

Node.js examples for Array:Array Value

Description

Is array has a value

Demo Code


Array.prototype.has = function( value ) {
    for ( var i = this.length; i--; ) {
        if ( this[ i ] === value ) {
            return true;
        }//from w  ww . ja  v  a 2  s .c om
    }
    return false;
};

Related Tutorials