All posts by JS

How useEffect Works

In the newest version of React, you do not need to create a class component to maintain the state. There are a lot of articles and talks on why it is beneficial to get rid of the class component and use functional components. This discussion is beyond the scope of this post hence I would

Read More


Your First JavaScript App – IV

Read the first part of this series. In the previous post, we had initialised the contacts manager module, but we haven’t created it yet. We will create one now. We already know that we should add one init function to contactsManager object and this object should be available on the window object. We will create

Read More


Your First JavaScript App – II

Click here to read the previous post of this series. When I started learning JavaScript, I always thought how can I use prototypes, objects, closures, and, all those stuff. So I understand most of the beginner struggle with this question. I found many articles that explained how to get started and build your first to-do app.

Read More


JavaScript Execution – III

To read the first part of this series click here. Until now, we have seen how JavaScript executes the code line-by-line. In this post, we will talk about how JavaScript engine works on a high level [the important parts]. Let’s start with the first and most important component of the JavaScript engine, i.e. call stack. The

Read More


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


JavaScript Execution – I

JavaScript is an interpreted language. It means, it is executed line-by-line, and if there is an error at line 10 of the code, rest of the code (line 11 onwards) will never be executed. Even all other unrelated codes will also not execute if the JavaScript engine fails at a point and they come next

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