Redefining a local variable with var in JavaScript

前端 未结 1 2081
轻奢々
轻奢々 2021-02-20 04:41

I have a rather general question regarding JavaScript and local variables. My question is what is the difference between the following and if there is any:

funct         


        
相关标签:
1条回答
  • 2021-02-20 05:19

    Any use of var within a function is hoisted. Subsequent uses on the same variable in the same scope have no effect.

    It has exactly the same meaning as a = 4; alone.

    0 讨论(0)
提交回复
热议问题