Javascript Array regexIndexOf(regex)

Description

Javascript Array regexIndexOf(regex)


Array.prototype.regexIndexOf = function(regex)
{
    for (var i = 0; i < this.length; ++i)
    {// w ww.j a v a  2s .c o  m

        if (this[i].match(regex))
        {
            return i;
        }
    }

    return -1;
};

String.prototype.capitaliseFirstLetter = function()
{
    return this.charAt(0).toUpperCase() + this.slice(1);
};



PreviousNext

Related