【发布时间】:2021-03-23 22:10:39
【问题描述】:
字符串已经定义如下:
const desc = `This is the password you use to access the $0 application. It is not the password for the $1 card. \n With the password, we can only read your statement. No other operations can be performed.`;
数组已经定义如下:
const params = ['American', 'American Black'];
我想更换:
$0 => American,
$1 => American Black
预期结果:
这是您用于访问美国应用程序的密码。这不是美国黑卡的密码。 \n 使用密码,我们只能阅读您的声明。不能进行其他操作。
【问题讨论】:
-
对,你的呢?
-
你能改变模板字符串吗?
标签: javascript arrays string replace