如何在JavaScript字符串中替換$ {...}的所有實例?例如:
var before = "My name is ${name} and I like ${sport} because ${sport} is challenging."
成爲
var after = "My name is Bob and I like soccer because soccer is challenging."
我試圖從Replace multiple strings with multiple other strings以下最好的答案,但你不能有一個帶有符號開始的關鍵...
非常感謝!
您嘗試過什麼嗎? – Blender