function foo(n) { var f = 3.14; // closure, this anon func has access to 'n' and 'f' // outside of scope of 'foo' return function() { console.log(2 * n * f); } } var bar = foo(3); bar(); // notes // as soon as n and f were referenced on line 6, they now belong to // a closure