JavaScript Tutorial ✦
Function Borrowing in JavaScript
Using a method from one object on another object by explicitly setting the context.
const arrLike = { 0: 'a', 1: 'b', length: 2 };
Array.prototype.join.call(arrLike, '-'); // 'a-b'
Using a method from one object on another object by explicitly setting the context.
const arrLike = { 0: 'a', 1: 'b', length: 2 };
Array.prototype.join.call(arrLike, '-'); // 'a-b'