A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-128.js
1functionadd(a,b){returna+b;}
2console.log(add.call(null,2,3));
3console.log(add.apply(null,[4,5]));
Scope
Answer & explanation
Console output
5
9
Why
Both call and apply invoke a function with an explicitly chosen this, differing only in how arguments are passed: call lists them individually while apply takes a single array. Since add ignores this, the results are just the sums 2+3 = 5 and 4+5 = 9. Remembering "apply = array" is the easiest way to keep the two methods straight.