// A function that generators a new function for adding numbers function addGenerator( num ) { // Return a simple function for adding two numbers // with the first number borrowed from the generator return function( toAdd ) { return num + toAdd }; } // addFive now contains a function that takes one argument, // adds five to it, and returns the resulting number var addFive = addGenerator( 5 ); // We can see here that the result of the addFive function is 9, // when passed an argument of 4 alert( addFive( 4 ) == 9 );