//js closure
//simple number sequence generator
function naturalgen(){
var num = 0;
return function(){
num += 1;
return num;
};
}
//sample string generator
function stringgen(string){
return function(){
string += string;
return string;
};
}
/* var f = stringgen("hello")
f
=> [Function]
f()
=> 'hellohello'
f()
=> 'hellohellohellohello'
f()
=> 'hellohellohellohellohellohellohellohello'
f()*/