Hello Jannes, hello Roy
Thank you for inviting me to this interesting discussion. I hope that my input will not be disappointing.
Seems we have IE to thank for this non-standard approach.
So yeah, we can thank IE, and also community and vendors of modern browsers.
Ok, back to the topic. Knowing that this feature is in the browsers does not really change much. Browsers do not restrict overwriting global variables, so there is a chance that someone might work twenty years in the industry and never notice this.
This feature might get problematic only in very abstract scenarios. Let’s say that I have element with
result, but I forgot to declare it. This might result in a hard to debug error, but:
- all linters (even the ones built-in into code editors) would notice this error and would let me know;
- if I ever assign some value to the
result - problem is gone;
- global variables seems obsolete, it’s rather uncommon to use them.
So I would not rant over web browsers because of this weird feature.
window object and with every month next are added. Building anything on an assumption that this given name will never be used as a name for one of the standard properties of the
window object is simply wrong.
@mtf the code in the repl, is it from the course? Sorry, it’s almost 1 AM and I am way too sleepy to get through this wall of text (instructions in this project).