JavaScript Execution – II

To read the part 1 of this post, click here. Simple function expression Let’s take this example: I have created foo variable before assigning a value to keep the execution simple. Let’s go through the two phase execution for this piece of code. Phase 1: Line 1: New variable foo, allocate memory for foo. Line 2:

Read More


Arguments

arguments in JavaScript is a special array-like object which is created implicitly during the execution of a function. It helps us to access those arguments which are not specified as the parameters during the function declaration. Let’s consider this example. Problem 1: We have to create a function which can add all the numbers passed

Read More


Functions in JavaScript

Everything in JavaScript is an Object. As we discussed in the previous post, JavaScript even treats the primitive data types as objects to provide additional functionality. Click here to see the example. Every programming language has functions, and a function is a reusable set of instructions. Apart from this, functions create their own scope. So

Read More


Why do you bind?

Have you ever run into a problem where you have added an event listener using bind, but the event handler continues to execute even though you have removed the listener? If yes, read on. A few months ago, when I was working on one of the React components, I added an event listener to the

Read More