Hello everyone! In this article, we shall try to understand the functionalities of JavaScript methods call()bind(), and apply().

In order to make it simpler for everyone, we shall be trying to understand them with the help of a simple example. Also, I shall make sure to not use tech-heavy jargon, so that even the new learners may understand the working of these methods easily without having to wrap their head around other stuff.

Additionally, I shall not be putting the code in a text editor or GitHub link so as to encourage you guys to code along as you read. It would really help you a lot, trust me on this. So, without any further ado, let’s get started.

First of all, let’s take a look at the basic example that we are going to follow. Here, we have created an object for an employee record, in which, we’ll be storing their basic information. Additionally, we’ll be setting up a method that can increment the salary of the employee by 10000.

Note: The “this” keyword is referring to the object in which it is situated. If it was used outside of the object, it would have referred to the window object.

#binding #programming #javascript #coding

Understanding Call(), Bind() & Apply() Methods in JavaScript In Simplest Way!
1.40 GEEK