JavaScript call() method is used to call a function with another object as the first argument.
Example
You can try to run the following code to learn how to implement call() method in JavaScript −
<html>
<head>
<script>
var person = {
Name:"John",
Department: "Finance",
fullName: function() {
return this.Name + " is from " + this.Department + " Department";
}
}
var myObject = {
Name: "Amit",
Department: "Marketing",
}
x = person.fullName.call(myObject);
document.write(x);
</script>
</head>
<body>
</body>
</html>