When registering JavaScript Events we need to provide the handler. That handler is called when ever a specified event is clicked. function clickHandler() { alert(‘Window is clicked’) } window.addEventListener(‘click’, clickHandler()) The problem with above code is that, we will see the alert as soon as windows loads. The expected result is show alert whenever we […]
Category: Java Script

Angular directive makes more sense when used in an example. The interesting example will make things fun to understand and follow. In our scenario we will handle the images that are failed to load. If you are more of a video person that I have also attached the video the end of the article Watch […]

Imagine if you transform your data like array for most of the time. Often times for loop with other variables are used to do the job. If it’s repeated than that code is extracted to its own function. Why not we extend the built in Array method and make it simple to use. Shuffle an […]
In the past whenever I came across code snippets with the usage of call() and apply(). I would ignore them as they appeared to be on advanced level. It was scary for me, as any new thing is. Than I found this code snippet function add(){ console.log(arguments) //Arguments { 0: 1, 1: 2, 2: 3, […]
Barrel file is a single place to re export your functions, variables etc for your modules. I have divided this post into Introduction Caveats Case Study