From 7d6412372702557255087da122f3c44135816be1 Mon Sep 17 00:00:00 2001 From: Adhithya-Krishna <125118003+Adhithya-Krishna@users.noreply.github.com> Date: Thu, 12 Oct 2023 11:05:17 +0530 Subject: [PATCH] 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 --- 01_Day_JavaScript_Refresher/01_javascript_refresher.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/01_Day_JavaScript_Refresher/01_javascript_refresher.md b/01_Day_JavaScript_Refresher/01_javascript_refresher.md index 7d03fb40af..ff64e49435 100644 --- a/01_Day_JavaScript_Refresher/01_javascript_refresher.md +++ b/01_Day_JavaScript_Refresher/01_javascript_refresher.md @@ -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.