Update 01_javascript_refresher.md

Minor Change , In this for loop it starts from 0 and goes to 2 and variable outside of loop gives 3 as output
pull/377/head
Adhithya-Krishna 1 year ago committed by GitHub
parent 8b41cd49c3
commit 7d64123727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1696,9 +1696,9 @@ if (true) {
console.log(gravity) // 9.81
for (var i = 0; i < 3; i++) {
console.log(i) // 1, 2, 3
console.log(i) // 0, 1, 2
}
console.log(i)
console.log(i) //3
```
In ES6 and above there is _let_ and _const_, so you will not suffer from the sneakiness of _var_. When we use _let_ our variable is block scoped and it will not infect other parts of our code.

Loading…
Cancel
Save