can't access lexical declaration `a' before initialization

Posted 渐行渐远~想

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了can't access lexical declaration `a' before initialization相关的知识,希望对你有一定的参考价值。

<script type="text/javascript">
alert(a);
let a=2;
</script>
以上代码报错:
 
ReferenceError: can‘t access lexical declaration `a‘ before initialization(在初始化之前,不能使用变量a)

以上是关于can't access lexical declaration `a' before initialization的主要内容,如果未能解决你的问题,请参考以下文章

由DBCursor的“can't switch cursor access methods”异常引发的思考

java.lang.SecurityException: Can't make field constructor accessible

python webdriver 报错WebDriverException: Message: can't access dead object的原因(pycharm中)

install xshell锛寈ftp <You can't access this shared folder because your organization's se

svn: Can't connect to host

You Don't Know JS: Scope & Closures (附加:Lexical/dynamic作用域)