26
rated 0 times
[
29]
[
3]
/ answers: 1 / hits: 16099
/ 12 Years ago, mon, october 29, 2012, 12:00:00
How to sum such an Array
[ '',
'4490449',
'2478',
'1280990',
'22296892',
'244676',
'1249',
'13089',
'0',
'0',
'0n' ]
If I call something like that ['','4490449', ... , '0n' ].reduce(function(t,s){ return t+s)
on that array, the stings are joined and not summed.
I've tried some casting with parseInt()
but this results in NaN
:)
More From » arrays