Tag: javascript

37 posts · All tags

Avoid Unnecessary Indirection

In programming, indirection is the ability to hold references to something, as opposed to the value itself. In object-oriented programming, indirection is used for dynamic dispatch and delegation). For example, we can use delegation as follows. This allows us…

Read more →

JavaScript Function Redux (+ ES6!)

JavaScript functions can be confusing sometimes. There are many ways to define them and many ways to invoke them. Throw in this, and things really starts to get fun. In this post we will revisit plain-old functions in JavaScript. The different ways we can…

Read more →

Designing AngularJS Directives

Throughout your adventures with Angular, you will undoubtedly come across situations where custom directives make sense. These situations typically involve DOM manipulations, or calling a jQuery plugin. However, there are other cases where you may not…

Read more →

JavaScript Anti-Patterns

There are plenty of posts discussing anti-patterns in other languages, like Java or Python . However, I haven’t really seen much regarding JavaScript besides this question on StackOverflow. And most of the ones I found don’t separate the DOM API…

Read more →

JavaScript: Optimizing loops

When looping through very large arrays, you may find this tip useful: it's much fast to use a while loop to iterate through an array than a for loop. For example, if you take this code: You can make it run faster by using a while loop instead. This works…

Read more →