Sum of array values in Javascript

home-brew-mac

How to sum of array values in Javascript ?

Sample :-

array.reduce(function(a,b){return a + b;},0)

Example :- 

let invoiceAmount = [1000, 1500, 2000];

invoiceAmount.reduce(function(a,b){return a + b;},0);

The above code return if the array is NULL and return the calculate value.

Sum of array values in Javascript

Packers and Movers in Dubai

Related posts

Leave a Comment