小编Bal*_*lla的帖子

当我们使用模板文字时,`use strict` 不起作用

如果我use strict用反引号/模板文字括起来,“使用严格”不会按预期工作。你能分享一下背后的原因吗?是否有任何类似的异常语句模板文字无法按预期工作?

`use strict`;
x = 3.14;  // Ideally it should  cause an error (as x is not defined).
alert(x);
Run Code Online (Sandbox Code Playgroud)

`use strict`; // if we enclose in single quotes or double quotes
x = 3.14;    // Ideally it should  cause an error (as x is not defined).
alert(x);
Run Code Online (Sandbox Code Playgroud)

javascript use-strict template-literals

2
推荐指数
1
解决办法
75
查看次数

标签 统计

javascript ×1

template-literals ×1

use-strict ×1