What is the difference between call, apply and bind?

function hello(greeting, mark) {
  console.log(greeting + ", " + this.name + mark);
}
const person = { name: "Maria" };

hello.call(person, "Hi", "!");
hello.apply(person, ["Hello", "?"]);
const bound = hello.bind(person, "Hey");
bound(".");

Output:

Tutorials Class - Output Window

Hi, Maria!
Hello, Maria?
Hey, Maria.

MethodRuns now?Arguments
callYesOne by one
applyYesAs an array
bindNo, returns a new functionOne by one, can be set in advance

Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.