Javascript Array betterIndexOf( needle )

Description

Javascript Array betterIndexOf( needle )



Array.prototype.betterIndexOf = function ( needle ) {
    for( var i = this.length - 1; i >= 0; i-- ) {
        if( this[i] === needle ) {
            return i;
        }//w  w w  .  j a  va 2 s .  c o m
    }
    return -1;
};



PreviousNext

Related