Write a program which returns the sum of numbers from 1 to N
Solution
function solution(N){
let sum = 0;
for (let i = 1; i <= N; i++){
sum = sum + i;
}
return sum;
}
Result