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:
8 + 9 will return 17
8.8 + 8 will return 16.5
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
function sum(num1, num2) {
console.log( num1 + num2);
}
sum.apply([4,7],[8,9]);
sum.apply(76,[8.8,8]);
sum.apply([8.8,8],2);
can you just tell me the answer with explanation
Yeah, so first of all you didn't use
this
inside your function. So, all the first arguments toapply
won't have any effect on the result.Results:
8 + 9
will return17
8.8 + 8
will return16.5
2
. If it had been an arraysum.apply([8.8,8],[2]);
then the result would have beenNaN
because it will evaluate2 + undefined
.I hope this answers your question.