Compare Scopes of the var and let Keywords i dnt understund

Tell us what’s happening:
can anyone help me to understand this lesson and why i returned 3 in the examples

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords

I watched videos and read articles until one day it made sense. Also doing the exercises in the javascript console in developer tools from the vdeos and articles. Couldn’t tell you which one it was, but it is necessary to have exposure to the subject outside of FCC. Here’s one video:
https://youtu.be/kjdZ1h3CIs4
Here’s a Google Search:
https://www.google.com/search?ei=BbQNXZ3KFciz0PEPw5aFiAk&q=explaining+javascript+variable+scope+to+a+beginner&oq=explaining+javascript+variable+scope+to+a+beginner&gs_l=psy-ab.3…14952.34102…35680…1.0…0.156.1426.17j1…0…1…gws-wiz…0i71j33i10.nKP1AO_Vb7c

Console logging the same var in a function and outside a function helps more than lot’s of video re-watching. Down the road you’ll realize you have experiential knowledge and some insight into debugging.

2 Likes

thanks for helping :slight_smile:

Here are a few more links.


You Don’t Know JS: ES6 & Beyond

1 Like