CallBindApply (CB01)
1: function greet(greeting, name) {
2: console.log(`${greeting}, ${name}!`);
3: }
4:
5: const person = { name: "Alice" };
6: greet.call(person, "Hello", "Bob");
call(): Purpose: Invokes a function immediately with a specified this value and individual arguments.
Hello, Bob!
CallBindApply context:
ES6 context:
Comments (
)
)
Link to this page:
http://www.vb-net.com/JavascriptES6/CB01.htm
|
|