The closure code is very short:
var fn = function() {
return function() {
console.log(arguments);
}
}
(function(arg) {
console.log('bar');
})('foo');
Why ["foo"]
is printed instead of bar
? If I comment out var fn = ...
, the result is as expected and bar
is printed. How can those 2 pieces of code be related?