The call()
function is a fantastic method in javascript. It makes some people confusion some times, like me. Here let us to make it clear.
Syntax
call([thisObj[,arg1[, arg2[, [,.argN]]]]])
- thisObj (optional): it’s object which can be act as currently
this
object. - arg1, arg2, argN (optional) : the parameters which can be passed to the method.
The call method can be used to instead of another object to invoke a method. It can change the object context of a function to a new object which thisObj referenced.