Javascript String indicesOf(substring)

Description

Javascript String indicesOf(substring)


String.prototype.indicesOf = function (substring) {
    var indexes = [],
        i = -1;/*  ww w  .  j  av a  2 s.  c o m*/

    while ((i = this.indexOf(val, i + 1)) != -1){
        indexes.push(i);
    }

    return indexes;
};



PreviousNext

Related