Nested vs Not nested

Edit on GitHub

Nesting

Setup

function foo(a,b){
function bar(){
return a+b;
}
return bar();
}

function foo2(a,b){
return bar2(a,b);
}

function bar2(a,b){
return a+b;
}

Tests

  • Nested

    var something = foo(1,2);
  • Not nested

    var something2 = foo2(1,2);