3 ms·
Well there's a reason that JavaScript used to support this but no longer does. Characterising it as 'implicit variable declaration doesn't work' seems like a fa
by kybernetikos 3y ago
Well there's a reason that JavaScript used to support this but no longer does. Characterising it as 'implicit variable declaration doesn't work' seems like a fairly reasonable summary of the view of a very large number of people.
To be true it doesn't need to be impossible to write code in a language with implicit declaration, it just needs to be significantly worse.
- bazoom42 3y agoIn JavaScript, implicit varible declarations goes to the global scope, which is obviously a footgun. In python they go to the local scope as you would expect.
- kybernetikos 3y agoGoing to local scope is obviously better, but it still allows misspellings (some of which are very difficult to see) to create new variables and have code that looks like it works but does something entirely different to what you expect.