JavaScript call() Explained Simply
With call you can write a method once, and then inherit it in another object, without having to rewrite the method for the new object.
function introduce(greeting, punctuation) {
return `${greeting}, ${this.name}${punctuation}`;
}
const user = { name: "Sam" };
console.log(introduce.call(user, "Hello", "!")); AI panel
Ask AI to clarify the parts you don’t fully understand, or go more in depth with MDN documentation.