JavaScript concat string with backspace

后端 未结 4 663
清酒与你
清酒与你 2020-12-17 20:18

I have a function f similar to

function f(str){
    alert(\"abc\"+str);
}

Now, I want to use JavaScript special charecter \"\\b\" in such a

4条回答
  •  无人及你
    2020-12-17 20:24

    EDIT: I realized this may not be what the OP was looking for, but it is definitely the easier way to remove characters from the end of a string in most cases.

    You should probably just use string.substring or string.substr, both of which return some portion of string. You can get the substring from 0 to the string's length minus 2, then concatenate that with "yz" or whatever.

提交回复
热议问题