JSFiddle - React, Tailwind, and code Playground
JavaScript
const handler = function()
{
console.log( {
"name": this.myName,
"arguments": arguments
} )
}
const myClass = function()
{
this.myName = "myObject with a name"
}
const myObject = new myClass()
const args = ["these","are","the","arguments"]
const oldInvocation = handler.bind.apply( handler, [myObject].concat(args) )
oldInvocation()
const newInvocation = handler.bind( myObject, ...args )
newInvocation()
const directInvocationWithApply = handler.apply( myObject, args )
const directInvocationWithCall = handler.call( myObject, ...args )
const deferedInvocation = handler.bind( myObject, ...args )
deferedInvocation()