Hoisting variable declarations across script tags?

后端 未结 3 606
死守一世寂寞
死守一世寂寞 2021-01-20 16:25

I have the following code inserted into a html file:

3条回答
  •  佛祖请我去吃肉
    2021-01-20 16:55

    MyVar is now defined in the scope of your second example (even though it might be in example 1). In your final block of code, myVar is declared. I highy reccomend reading about variable scope in JavaScript (and Java)

提交回复
热议问题