The prototype is an object that is associated with every function and object by default in JavaScript, where the function’s prototype property is accessible and modifiable and the object’s prototype property is not visible.

Each object has a private property that holds a link to another object called its prototype…

A polyfill is a browser fallback, made in JavaScript, that allows functionality you expect to work in modern browsers to work in older browsers, e.g., to support canvas (an HTML5 feature) in older browsers.
A polyfill is a piece of code that provides the methods that the developers, expect the browser to provide natively.

Creating a polyfill for bind function

polyfill for bind method

Async and defer are boolean attributes that are used along with the script tag to load the external scripts efficiently into our webpage.

Normal Script: Suppose the browser is loading a webpage and parsing the HTML line by line and suddenly encountering a script tag then what happens is the…

When we run the code a global execution context is created. Execution context is created in two phases i.e. memory creation phase and code execution phase.

Let’s understand this with the help of a program.

var x = 10;function square(num) {
var ans = num * num;
return ans…

Everything in JavaScript happens inside an Execution context.
Execution context is like a big box which has two component in it.
🔹 The first component is known as the Memory component.
🔹 The second component is known as the Code component.

Memory component: This is the place where all variables and functions are stored as key-value pairs. Memory component is also known as the Variable Environment.

Code component: This is the place where the whole code is executed one line at a time. This is also known as the Thread of execution.

JavaScript is a synchronous, single-threaded language which means javaScript can only execute one command at a time, when we say synchronous single-threaded that means javascript can only execute one command at a time and in a specific order, it can only go to the next line once the current line has been finished executing.

Ayesha Malik

I’m a full-time software engineer who loves sharing knowledge to help others become better developers.

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