How to effectively attach eventListeners to DOM elements

Anonymous functions are great way to quickly get the job done, but can be a huge problem when used carelessly. It is especially when attaching eventListeners to DOM elements. Take the code below for example. Here we are attaching an eventListner to the element for the "click" event. Now, later lets say for some reason … Continue reading How to effectively attach eventListeners to DOM elements

Advertisements

Better use of Memoization JavaScript

Referring to the post Generating Unique Strings (Ids) in JavaScript where we looked at how to generate unique strings in JavaScript. Also I mentioned the performance and memory issues with the approach. So, here we are going to look a much better use or application of Memoization, but we won't be using it for generating unique strings. We will be … Continue reading Better use of Memoization JavaScript