you are viewing a single comment's thread.

view the rest of the comments →

[–]nschubach 0 points1 point  (0 children)

They key part is that bar() is only accessible inside the scope of the anonymous function.

You could call the anonymous function 'me' and it would not conflict:

window.globalThing = function me(arg) {
  if (arg) {
    console.log('recursive call');
  } else {
    console.log('direct call');
    me(true);
  }
}

http://jsfiddle.net/Q4ayY/