function sum_all() { var result = 0; for (var i = 0; i <= 100; i++) { result += i; } return result } var s = sum_all(); alert(s);