numberSum = (n) => { let total = 0; for (let i = 1; i < n; i++) { total += i; } return total; } numberSum(10)
n * (n + 1) / 2