我有一个包含多个逗号的字符串,字符串替换方法只会更改第一个:
var mystring = "this,is,a,test" mystring.replace(",","newchar", -1)
结果:"thisnewcharis,a,test"
"thisnewcharis,a,test"
文档指出默认值替换all,并且"-1"也表示替换all,但是不成功.有什么想法吗?
javascript string replace substitution
javascript ×1
replace ×1
string ×1
substitution ×1