我在尋找如何用'和'替換字符串中的最后一個','時遇到問題:具有以下字符串:test1,test2,test3我想以:test1,test2和test3結尾我正在嘗試這樣的事情:var dialog = 'test1, test2, test3'; dialog = dialog.replace(new RegExp(', /g').lastIndex, ' and ');但它不起作用
如何使用javascript替換字符串中字符的最后一次出現
蕭十郎
2019-12-05 13:12:08