When i try this simple script
var array1 = global.get('waterContractPeriodMonth')
console.log('contractPeriodMonth is: ' +array1)
tmp = array1.reduce((partialSum, a) => partialSum + a, 0);
console.log(' counting contractPeriodMonth is: ' +tmp)
This is the result:
contractPeriodMonth is: 3895.00,0,16750,16750,16750,16750,16750,16750,16750,16750,16750,16750
counting contractPeriodMonth is: 03895.00016750167501675016750167501675016750167501675016750
Using Number(array1) doesn’t work to get a descent result. How can i use reduce to get a descent result.