For loop does not create a new scope
Unlike in other languages, the content of a for loop is not in a new scope. Let me show you. var elements = document.getElementsByTagName("*"); for (var i = 0; i < 10; i++){ // inside the loop var current …
Tips and tricks I learned throughout the years.
JavaScript looks familiar to many engineers, but behaves differently in all the places that matter. Here I share practical lessons that help whether you're just getting started or already shipping in production.
Unlike in other languages, the content of a for loop is not in a new scope. Let me show you. var elements = document.getElementsByTagName("*"); for (var i = 0; i < 10; i++){ // inside the loop var current …
When I started using JavaScript, the alert function quickly became my best friend. I didn't use it to display annoying messages to my users. I used to debug my code. The cool thing about it is that it stopped execution o…
This is one of those things you probably saw and didn't even know how to google. I didn't know what it's called so I had to ask on stackoverflow. So you define an anonymous function and call it right away: (function(){ …
The most confusing functions in JavaScript are the call() and apply() methods. Interviewers have learned of this and are starting to use it against the unsuspecting candidates. Well, fear no more, by the time you are don…
JavaScript went from being a scripting language that was used to open a popup when you click on a button, to a language used to open a weird popup when you click on a button. The language was powerful from the beginning …