DeveloperBreeze

Function Context Development Tutorials, Guides & Insights

Unlock 1+ expert-curated function context tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your function context skills on DeveloperBreeze.

Understanding call, apply, and bind in JavaScript

Tutorial August 30, 2024
javascript

function greet(greeting, punctuation) {
    console.log(greeting + ' ' + this.name + punctuation);
}

const person = { name: 'Alice' };

greet.apply(person, ['Hello', '!']);  // Output: "Hello Alice!"

Here, greet is called with person as the this value, and the arguments are passed as an array.