Why was the name 'let' chosen for block-scoped variable declarations in JavaScript?

后端 未结 8 923
醉酒成梦
醉酒成梦 2020-12-07 06:47

I understand why var takes that name - it is variable, const - it is a constant, but what is the meaning behind the name for let, whic

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-07 07:38

    Let uses a more immediate block level limited scope whereas var is function scope or global scope typically.

    It seems let was chosen most likely because it is found in so many other languages to define variables, such as BASIC, and many others.

提交回复
热议问题