This is a short piece of code of JavaScript
. And why this arrow
function is returning answer 6?
var arguments = [1, 2, 3];
function foo(n) {
var f = () => arguments[0] + n;
return f();
}
console.log(foo(3));
I was expecting answer to be 4.