DEV Community

Discussion on: call(), apply() and bind() in Javascript

Collapse
 
thesanjeevsharma profile image
Sanjeev Sharma

Yeah, so first of all you didn't use this inside your function. So, all the first arguments to apply won't have any effect on the result.

Results:

  1. 8 + 9 will return 17
  2. 8.8 + 8 will return 16.5
  3. will throw an error as the second argument should be an array but you passed a value 2. If it had been an array sum.apply([8.8,8],[2]); then the result would have been NaN because it will evaluate 2 + undefined.

I hope this answers your question.