You also need to remember that let and const have block scope:
let
const
let i = 0; console.log(1,i); if(i===0){ let i = 1; console.log(2,i) } console.log(3,i)
This will result in a log of
1 0 2 1 3 0
Actually, not mentioning this was one of the goals of my article. I think this behavior, for new programmers, is logically the most sensible!
(Having a comment pointing it out is fine though 😅)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You also need to remember that
let
andconst
have block scope:This will result in a log of
Actually, not mentioning this was one of the goals of my article. I think this behavior, for new programmers, is logically the most sensible!
(Having a comment pointing it out is fine though 😅)