How to sum all values in an array?

In some case we need to the sum of all the numbers passed in an array where we have an array in object form, so to perform this task we need to use a loop. This loop will iterate the given array and return the sum of all numbers. To understand more clearly, let’s take a simple example.
Example
Data = [‘199’, ‘499’, ‘999’, ‘1399’]
Now define a variable with value 0 like below. This variable will hold the sum of number.
Sum_of_price += 0;
In next step, start a for loop which will start from 0, and it should be executed up to the length of array so to do this we have also needed to take the length of array like below.
for(i=0;i<=selected_data.length-1;i++){

         // code here for sum of array

       }
Paste the below code to iterate the loop.
Sum_of_price += parseFloat(Data[i]);
Now check the output in console
console.log(Sum_of_price);
Output

WHow to sum all values in an array?expoundsofttechsolution

d