Assignment without let | Sololearn: Learn to code for FREE!

+1

Assignment without let

What is the difference between assigning a variable with and without "let" in javascript?

3/9/2021 10:17:38 AM

Sai Ganesh Darni

2 Answers

New Answer

+2

let declare block scoped variable(s) var declare function scoped variable(s) variable assigned but not declared are implicitly declared as global (var)... in non 'strict mode' (else it will throw an error)

0

let & const: both are block-scoped but const can't be reassigned var: either function-scoped or globally-scoped depending on the context without any of these: globally-scoped but as vespeh said, be aware that there are differences between strict mode and "sloppy" mode