Is there a purpose to hoisting variables?

前端 未结 3 874
隐瞒了意图╮
隐瞒了意图╮ 2020-12-16 23:24

I\'ve been learning a lot of Javascript lately and I\'ve been trying to understand the value (if there is any) of hoisting variables.

I understand (now) that JS is a

3条回答
  •  旧巷少年郎
    2020-12-17 00:03

    Not really. The only thing I can think of where it would be helpful is if you are writing code in a hurry and you happen to declare it later on. So it doesn't really matter, it's a weird addition to JS that a lot of people don't really even know about because utilizing it feels backwards and inefficient.

提交回复
热议问题