【问题标题】:template literals not working in atom.io模板文字在 atom.io 中不起作用
【发布时间】:2018-07-23 06:41:00
【问题描述】:

我正在关注关于模板文字的 javascript 教程。 我完全遵循了讲师的代码,但我无法获得与他相同的输出。 (是的,我正在使用 backtics)

let name = 'bob'; 
console.log(`hi $(name)`);

Instructor Output: hi bob
My Output: hi $(name)

【问题讨论】:

    标签: template-literals


    【解决方案1】:

    你需要使用大括号

    let name = 'bob'; 
    console.log(`hi ${name}`);
    

    它会输出hi bob

    有关详细文档,请参阅:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-13
      • 1970-01-01
      • 2022-08-07
      • 2021-02-08
      • 2022-01-05
      • 1970-01-01
      相关资源
      最近更新 更多