function sum() {
var result = 0;
var i = 1;
return function calc() {
result += i++;
return i > 100 ? result : calc();}();}
var result = sum();
console.log(result);
function sum() {
var result = 0;
var i = 1;
return function calc() {
result += i++;
return i > 100 ? result : calc();}();}
var result = sum();
console.log(result);