apply vs call javascript code example
Example: call() vs apply() vs bind()
Differentce between .bind() , .call() and .apply()
.bind(someobj) -> does not invoke the function, it just allows you to
bind whatever object you want, you have to call the function yourself.
.call(someobj) and .apply(someobj)-> both invoke the function
immediately,and modify the context.
The only difference is how you pass your
own arguments. See below
.call(someobj, param1, param2)
.apply(someobj, [param1, param2]) //uses array to pass the args