0

Difference between (var ) and (let) in js ???

Difference between (var ) and (let) ???

9th Oct 2019, 7:11 AM
Ferdaws Frotan
Ferdaws Frotan - avatar
2 ответов
+ 2
1. var is function scoped, which mean code outside of function can be accessible anywhere which is a bad thing. let is block scoped meaning code inside curly braces ({}) cannot be accessed from outside. 2. var is going to give undefined when accessing a variable before it's declared, let give ReferenceError when accessing a variable before it's declared.
9th Oct 2019, 7:24 AM
Rizky
Rizky - avatar
+ 4
just google it. you will get lot of resources with various example. 👍
9th Oct 2019, 7:40 AM
Nahidul Islam
Nahidul Islam - avatar