This is true. I think, in this particular case I made the mistake of testing things in jsFiddle, which doesn’t tell you that your code is actually inside window.onload function (but makes you believe you are in global scope.) That was the day I stopped using it as my JavaScript test environment.

There are two problems I found, when trying to explain deeper / more complex variable definitions that are usually not even considered language features, but exist as a side effect of JavaScript specification evolution throughout the years. . . 1) It’s a bit like splitting hair and 2) When coding you usually don’t even think about these things. You either stick to var or let.

Anywho, regardless… these types of inconsistencies are hard to explain with 100% accuracy. But yes, I always knew there will be mistakes in my Medium tutorials :) My hope is to iteratively improve / update them based on reader feedback. So thanks for pointing this out!

Written by

Issues. Every webdev has them. Published author of CSS Visual Dictionary https://amzn.to/2JMWQP3 few others…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store