我知道在PHP中我们可以这样做:
$hello = "foo"; $my_string = "I pity the $hello";
输出: "I pity the foo"
"I pity the foo"
我想知道在JavaScript中是否也可以使用同样的东西.在不使用串联的情况下在字符串中使用变量 - 它看起来更简洁和优雅.
javascript string variables string-interpolation
javascript ×1
string ×1
string-interpolation ×1
variables ×1