Answers for "how to add a letter to a string javascript"

0

how to add a letter to a string javascript

String.prototype.splice = function(idx, rem, str) {
    return this.slice(0, idx) + str + this.slice(idx + Math.abs(rem));
};

var result = "foo baz".splice(4, 0, "bar ");
document.body.innerHTML = result; // "foo bar baz"
Posted by: Guest on April-05-2021

Code answers related to "how to add a letter to a string javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language