I have this simple array with numbers:
var arr = [100,200,undefined,450,300];
I would like to use reduce for quickly summing up the values in that array like so...
var total = arr.reduce( function( s, v ){ return s += v } );
In return I am getting NaN.
Is there any way to make reduce to sum values in array with undefined values? like a flag or something... Thanks!