> Articles > Function Borrowing In JavaScript

Function Borrowing In JavaScript

In this article we will explain function borrowing in JavaScript. This is also called method borrowing in JavaScript.

Function can be borrowed from one object to use it for another object.

What is Function Borrowing In JavaScript?

We can use call() and apply() method to borrow the function from one object and that function can be used for another object. Let's see the implementation of function borrowing in JavaScript.

Implementation

functionborrowing.js

Function Borrowing in JavaScript - Source Code Example

Output

Function Borrowing in JavaScript - Example Output


Suresh Kumar Srivastava is founder of online learning site coursegalaxy.com and author of popular books "C In Depth", "Data Structures Through C In Depth". He has 18+ years experience in industry and worked on architecture and design of multiple products. This article is from his course on Advanced JavaScript.