In this example:
function foo () {
function bar () {
return 'foo bar';
}
bar();
}
foo();
Is bar
reevaluated for every x times that foo
is called?
Conversely:
function bar () {
return 'foo bar';
}
function foo () {
bar();
}
foo();
This benchmark shows that the later example is +/- 1.6x faster (in Chrome).
If not reevaluated, why would the 2nd pattern be significantly faster than the 1st pattern?