SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

我们在编译.js文件是会出现一个问题,也就是如下图:
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside stri小编也百度了一下,说版本太低,然后让我去官网下载node又是更新的,好麻烦,我就直接翻译了一下,大意如下图:SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside stri看到翻译就知道了吧,这是因为严格模式外不能使用使用let,const之类的es6的命令,也就是说你的版本太低了,怎么办,最简单的办法就是在你的代码最前面加上一句话,
‘use strcit’;即可,如图:
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside stri好了,问题解决了,总结:并不是任何一个错误都要百度,懂了错误的意思自己就知道怎么做了。

相关文章:

  • 2021-12-22
  • 2022-12-23
  • 2021-11-26
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
猜你喜欢
  • 2022-12-23
  • 2021-11-08
  • 2021-12-28
  • 2021-06-19
  • 2021-08-07
  • 2022-12-23
  • 2021-04-13
相关资源
相似解决方案