我本来期待找到两者const
and let
作为保留关键字。我只找到了 https://www.ecma-international.org/ecma-262/8.0/index.html#prod-ReservedWord const
,但是没有let
:
Keyword::
await
break
case catch class const continue <---- `const` here
debugger default delete do
else export extends
finally for function
if import in instanceof
new
return
superswitch
this throw try typeof
var void
while with
yield
Is let
一个关键字?如果没有,为什么?
let
wasn’t reserved before ES6 ES5 strict mode https://es5.github.io/#C, so it can’t be treated the same as the rest of the reserved words for backwards-compatibility reasons like this:
var let = 5;
您会在新构造的规范中发现很多例外情况(例如let let = 5;
是无效的)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)