function f1() { var n = 9; nAdd = function() { n = n + 1; } function f2() { console.log(n); } return f2; } var result = f1(); result(); //9 nAdd(); result(); // 10 var consult = f1(); consult(); //9