showing results for - "first n even numbers sum javascript"
Bartholomew
17 Jan 2016
1// return the sum of the first n even numbers recursively. Assume n > 0
2
3function firstEvenNumbersSum(n) {
4    if (n === 0) {
5        return 0;
6    }
7    let num = (n * 2);
8    let sum = num + firstEvenNumbersSum(n-1)
9    return sum;
10}
11