Javascript Array insertStringBefore(str)

Description

Javascript Array insertStringBefore(str)


Array.prototype.insertStringBefore = function(str){
    for(var i=0; i< this.length; i++){
        if(angular.isString(this[i])){
            this[i] = this[i].insertBefore(str);
        } else {//from   ww w.j  a v  a2 s  .  c  om
            console.log("Type of "+ this[i] + " is not string: " + typeof this[i]);
        }
    }
}

String.prototype.insertBefore = function(str){
    return str + this;
}



PreviousNext

Related