3 ms·
There are so many gotchas that I give up even trying to remember them, thus I just try the code to find out what it will do. One fun one that just came up is th
by user3939382 4y ago
There are so many gotchas that I give up even trying to remember them, thus I just try the code to find out what it will do. One fun one that just came up is that async callbacks work totally different inside a forEach vs a for loop. https://developer.mozilla.org/en-US/docs/Glossary/Hoisting https://developer.mozilla.org/en-US/docs/Glossary/Hoisting
I’m sure someone out there has compiled the list of things that don’t make sense.
It’s like 100 people designed different features without talking to each other and glued it all together into one language.
- lenkite 4y agoIn one of my earlier JS projects, the coding guidelines strictly enforced the rule of declaring all variables at top of the function to not get confused by JS hoisting "magic". You need to enforce coding conventions in JS as soon as you have greater than one person working on a project. Sometimes even if you are the lone person - esp if you are coming back to it after a delay.