Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
692 views
in Technique[技术] by (71.8m points)

JS的换行字符串``, 占位符怎么动态替换

let name = "啊啊啊"
let str = `you are name ${name}`
console.log(str)
name = "呃呃呃"
console.log(str)


you are name 啊啊啊
you are name 啊啊啊 // 还是输出 啊啊啊 怎么解决?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

字符串是不可变的


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...