Image for post
Image for post
Photo by Clay Banks on Unsplash

After a lot of digging, I understood how node.js internally works. This blog is based on my researches, stay patient to deep dive!😁

Okay! So let’s understand first what Node.js is 🐘. The documentation says: “Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.”

A lot of fancy words here 🤯. Let’s together break it down 💪 First thing first, what is runtime and why node.js is a runtime ???

A runtime is any code that is executed to make your code work. The code that we write some code that will be executed by the runtime. A runtime can consist of a compiler, an interpreter, an engine to execute your code, thread pool to provide threads for your code’s process. …


Image for post
Image for post

Hello people🌼! This article will tell you anomalies in JavaScript arrow functions. Prerequisites before reading this article-

  1. Syntax of Arrow Functions
  2. this in JS

Personally, I use the JS arrow function almost every day and I guess many developers do. It’s syntax — one of the best syntax introduced to JS language. Arrow function has made the life of dev easier but today we will talk about its pitfalls!🐞

Argument Binding🦋

Let’s suppose we want to define a function that calculates the sum of any number of arguments passed to it. …


Image for post
Image for post
Photo by Chewy on Unsplash

Asynchronous programming is not a new concept. It has been with us from the very early days of computing because we need to make the best usage of the hardware. But recently it has become a standard programming paradigm.

Let’s understand a few concepts before understanding asynchronous programming.

Threads

Threads are a sequence of execution of code that can be executed independently of one another. It is the smallest unit of tasks that can be executed by an OS. A program can be single-threaded or multi-threaded.

Process

An active program i.e a program under execution is called a process. A program can have multiple processes. A process usually starts with a single thread and later it creates multiple threads. …


Image for post
Image for post

ES5 vs ES6 -one of the most important questions asked in the interview!👻Modern browsers currently support ES5 but ES6 has made writing the code for devs much easier and also tackles a lot of limitations of the language.

ES5 vs ES6

Normal function vs Arrow function

Here is the ES5 version -


Image for post
Image for post
Photo by Dave Hoefler on Unsplash

Async programming is a way to fasten the single-threaded mechanism. There are many ways in JavaScript to handle asynchronous operation, one of them is Async and Await.

What the heck is async and wait??

Asyn and Await is an extension to the syntax used in writing promises. It’s a syntactical sugar over promises. It is used to get rid of promise hell. One must know about Promises before knowing async and await.


Image for post
Image for post
Photo by Galina N on Unsplash

If you have not read about callbacks, I strongly recommend you to read about callbacks in JS. Callbacks in JS

Promises in JavaScript are just like promises that you make in real life. It has 3 states-

  1. Pending:-When a promise is created
  2. Resolved: When you have fulfilled your promise
  3. Rejected: When you have not fulfilled your promise

A promise is an object that does an asynchronous operation and notifies when it’s done. …


Image for post
Image for post

Hello people!💗 This article is about one of the most important interview question -callbacks and promises✌.

Functions in JavaScript are objects. Because of this, functions can take functions as arguments and can be returned by other functions. Any function that is passed as an argument and called by the function that receives it, is called a callback function.

Wait, What!!🎃

Let’s see-

Operations in JavaScript are executed from top to bottom(synchronous). For instance-


Image for post
Image for post

Hello people🌹! This article will cover the usage of ‘this’ in call(), apply() and bind().

call(), apply() and bind() is used to define the context of ‘this’ inside a function of a method.


Image for post
Image for post

Hello folks!🌄 This article is all about the most interesting topic of JavaScript -this .

this points to a particular object. Now, what this object totally depends on how and where this keyword is used.

Just remember the 6 golden rules and you are all set to go😃💗-

  1. Global:- this →window
  2. Inside function:- this →window
  3. ES5 method:- this →object
  4. ES5 function inside the ES5 method:- this →window
  5. ES6 function inside the ES5 method:- this →object
  6. this inside ES6 arrow function always takes value from the parent scope(surrounding scope)

Global🎃


Image for post
Image for post
Photo by Halacious on Unsplash

Hello beautiful people 🌻! This article is all about Prototypes in JavaScript. The need for prototypes is described in my previous article JS Constructor Function, important to read this before you go through prototypes.

Whenever an object is created, the JS engine adds an internal property called prototype.

Prototype is simply an object that has a constructor property by default. The constructor property points back to the function where the prototype object is a property.👻

function Person(firstName, lastName) {
this.firstName = firstName,
this.lastName = lastName,
this.fullName = function() {
return this.firstName + “ “ + this.lastName;
}
}
let p1 = new Person(‘Harry’, ‘Porter’)…

About

Prachi

Breaths JavaScript❤

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store