what is call apply bind code example
Example: call apply bind
const obj = { number: 1 }
function foo() {
console.log(this.number)
}
//bind - binds obj's 'this' context to foo, but doesn't call it
const newFoo = foo.bind(obj)
//call/apply - binds obj's 'this' context to foo, then calls it
foo.call(obj, /*arg1*/, /*arg2*/)
foo.apply(obj, [/*arg1*/, /*arg2*/])
//Only difference between call/apply is argument passing - ',' vs '[]'