📌  相关文章
📜  如何在字符串中添加字母 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:55.838000             🧑  作者: Mango

代码示例1
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"