[英]ES6 Template strings: how to nest them?
I'd like to nest them like this but I get error.我想像这样嵌套它们,但出现错误。 Is there a way?有办法吗?
let greetings1 = 'hello1';
let greetings2 = 'hello2';
let template1 = ``${greetings1}``;
let template2 = ``${greetings2}``;
let template = `${template1}`;
console.log(template);
I hope this helps.我希望这有帮助。
let greetings1 = 'hello1'; let greetings2 = 'hello2'; let template = `${greetings1} ${greetings2}`; console.log(template);
The problem is the double quotation marks问题是双引号
let greetings1 = 'hello1'; let greetings2 = 'hello2'; let template1 = `${greetings1}`; let template2 = `${greetings2}`; let template = `${template1}`; console.log(template);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.