0

I have read that in sloppy mode function declarations are function scoped just like var with value of actual functions. But I want to know why can't I access the inside() function code below:

function outside() {
  var first = 'hello';
  inside();
  if (true) {
    var second = 'second';

    function inside() {
      var third = 'third';
      console.log(third);
    }
    inside();
  }
}
outside();

(I have added the snippet above.) Can someone explain about it?

Talha Ali
  • 1
  • 1

0 Answers0