Find the sum of n numbers:

var sum = 0;

for( i = 1; i<=10; i++){

sum = sum +i
Copy the code

}

console.log(sum);


Use the for loop to calculate the value, define sum to accept I, and get the sum of the numbers.