Javascript Array getFirstIndexThat(test)

Description

Javascript Array getFirstIndexThat(test)


/*-----------*//*  ww  w. j  a v a  2  s . c  o m*/
/* FROM ALBUM LAND && NOTES*/
/*-----------*/

Array.prototype.getFirstIndexThat = function(test) {

    for(var i = 0; i < this.length; i++)
    {
        if (test(this[i])){
            return i;
        }
    }
    return null;
}



PreviousNext

Related