What is Call in JavaScript ? Last Updated : 07 Feb, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The call method is used to invoke the function with different this object. In JavaScript, this refers to an object. It depends on how we are calling a particular function. In the global scope, this refers to the global object window. The inside function also refers to the global object window. In strict mode, when we use any function then this refers to undefined. In functions like call, this could refer to a different object. With the help of the call method, we can invoke a particular function with different objects. Syntax:functionName.call(thisArg, arg1, arg2, ...)Parameter:functionName: The function to be called.thisArg: The value to be passed as the this parameter when calling the function. If the function is a non-method function (i.e., a function declared at the global scope), thisArg is the global object (window in a browser, global in Node.js).arg1, arg2, ...: Arguments to be passed to the function individually.Example: Here, We have an object person with a method fullName that takes two additional parameters city and country. We have two other objects, john and jane, representing different people with their first and last names. We use call to invoke the fullName method of person, passing john and jane as the this value respectively, along with additional arguments representing the city and country. The fullName method of person is invoked with the this context set to john and jane respectively, resulting in the output of their full names along with the provided city and country. JavaScript const person = { fullName: function (city, country) { return `this.firstName + " " + this.lastName + ", " + city + ", " + country;` } } const john = { firstName: "John", lastName: "Doe" } const jane = { firstName: "Jane", lastName: "Smith" } // Using call to invoke the fullName // function with different this values console.log( person.fullName.call(john, "New York", "USA")); console.log( person.fullName.call(jane, "London", "UK")); Outputthis.firstName + " " + this.lastName + ", " + city + ", " + country; this.firstName + " " + this.lastName + ", " + city + ", " + country; Comment More infoAdvertise with us Next Article JavaScript Course What is JavaScript ? A amanv09 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-QnA WebTech-FAQs Similar Reads What is JavaScript? JavaScript is a powerful and flexible programming language for the web that is widely used to make websites interactive and dynamic. JavaScript can also able to change or update HTML and CSS dynamically. JavaScript can also run on servers using tools like Node.js, allowing developers to build entire 6 min read What is Math in JavaScript? JavaScript provides a built-in Math object that provides a set of methods to perform mathematical operations. These operations range from basic to more complex functions like trigonometry and logarithms. The Math object allows you to perform calculations without the need for writing custom functions 2 min read JavaScript Function Call The call() method is a predefined JavaScript method. It can be used to invoke (call) a method with an owner object as an argument (parameter). This allows borrowing methods from other objects, executing them within a different context, overriding the default value, and passing arguments. Syntax: cal 2 min read JavaScript Course What is JavaScript ? JavaScript is a very famous programming language that was originally started in the year of 1995 with the motive of making web pages alive. It is also an essential part of the web developer skillset. In simple terms, if you want to learn web development then learn HTML & CSS before starting JavaScri 3 min read Console in JavaScript The console object provides access to the browser's debugging console (or terminal in Node.js). It is used to log information, debug code, and interact with the runtime environment during development.Commonly Used console MethodsHere are the most frequently used methods of the console object:1. cons 3 min read JavaScript function caller Property The function.caller property of the JavaScript function object returns the function that invoked the specified function. It returns null if the function "f" was invoked by the top-level code in JavaScript. For functions like strict functions, async functions, and generator functions this method retu 2 min read Like