Context with Apply
sum() function. apply() method to add the values of the this array and return the result. numbers array should be passed as the this object when calling the apply() method on the sum() function.Solution Walkthrough for Context with Apply
Spoiler Alert!
Don't read this unless you've already solved the problem.
apply(), we can pass an array as the context for the function execution. In this case, we pass the numbers array as the first argument to apply(), which sets this inside the sum function to the numbers array.sum function, we access the first and second element of the this array using [0] and [1] respectively, and return their sum.