From 35f9375648e3ff1d7a4395bcd356ef9ff865275f Mon Sep 17 00:00:00 2001 From: Patrick Njuguna Date: Thu, 9 Jan 2020 08:47:37 +0300 Subject: [PATCH] local scope illustration fix this new structure illustrates the local scope to the block of d. the other structure was incorrect since c is still in scope --- 08_Day/08_day_objects.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/08_Day/08_day_objects.md b/08_Day/08_day_objects.md index 1c767ed..06c2614 100644 --- a/08_Day/08_day_objects.md +++ b/08_Day/08_day_objects.md @@ -110,10 +110,10 @@ function letsLearnScope() { let a = 'Python' let b = 20 let d = 40 - console.log(a, b, c) // Python 20 30 + console.log(a, b, c, d) // Python 20 30 40 } - // we can not access c because c's scope is only the if block - console.log(a, b) + // we can not access d because d's scope is only the if block. c is still in scope + console.log(a, b, c) // JavaScript 10 30 } letsLearnScope() console.log(a, b) // JavaScript 10, accessible