-1

can someone explaine to me why foo isnt alerted as 10?`

var foo = 1;

function bar() {
  foo = 10;
  return;

  function foo() {}
}
bar();
alert(foo);

I tried to console.log foo outside bar in order to see if foo has change and it was foo=10.

VLAZ
  • 26,331
  • 9
  • 49
  • 67

0 Answers0