Code Notes

JavaScript

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.

JavaScript tips - Page 7

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 …

Read article

Self invoking function

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(){ …

Read article

How to use JavaScript Call and Apply methods

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…

Read article

Getting Started with JavaScript

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 …

Read article

Previous Page 7 Next