The throttle is very similar to debounce, they both avoid the unnecessary actions to be fired.

Imagine if you have a button and if we click it multiple times in quick succession then the event associated with that event would get fired multiple times and we want to avoid that.

Throttle works a little different than debounce if we build a function called throttle and add some delay to it let’s say 10sec, then what really happens on the first click the event would get fired within that delay let’s ay 10 sec and if the user clicks on it…


Both rest and spread operators have similar syntax i.e 3 dots (…)

The spread operator is used to create copies of array/objects.

The rest operator is used to collect all the remaining values.


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. That prototype object has a prototype of its own, and so on until an object is reached with null as its prototype and acts as the final link in this prototype chain. Nearly all objects in JavaScript are instances of Object, which sits on the top of a prototype chain.

Prototypical Inheritance


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 browser stops the parsing at that point of time and then fetches the script from the network and gets executed then and there. When the script is fetched from the network and executed into the browser then the HTML parsing will continue to parse only when the script is executed.


Currying is a process in functional programming in which we can transform a function with multiple arguments into a sequence of nesting functions. In other words, it restructures a function so it takes one argument then returns another function that takes the next argument, and so on.

We will learn two ways to curry our functions. The first one is by using the bind function and the second is by using the concept of closures.

we can use multiply method to create multiply by 2, multiply by 3 and so on. We can make multiple copy of multiply method by…


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;
}
var square1 = square(x);
var square2 = square(6);

In the first phase of memory creation, javascript will allocate memory to all the variables and functions.
JS will allocate memory to variable x and stores a special value that is undefined. In the case of function JS will allocate memory…


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