Find summation of an array
Problem:
Suppose, you have an array like this myArray=[2,3,4,5,6,7,8,9]
You need to find summation of this array.
Solution:
let sum = 0;
let myArray = [10, 20, 30, 40, 40, 50, 60, 70, 80, 90];
for (let i = 0; i < myArray.length; i++) {
sum = sum + myArray[i];
}
console.log("Sum of this array: " + sum);