2021年3月22日星期一

Getting the sum for all of the object retrieve from SharePoint API

  .subscribe((dataTotal) => {      console.log(dataTotal)      this.toGetHourData=dataTotal;            const AssociateArray = []      AssociateArray.push({dataTotal : Number})        let associateSum: number = 0;      AssociateArray.forEach(a => associateSum += a.value);      console.log(associateSum);      },  

This is my code. I have pushed all of the object into an array. but when i try to sum it up. the console log a NaN.

p.s: this is my first time with stackoverflow

https://stackoverflow.com/questions/66755951/getting-the-sum-for-all-of-the-object-retrieve-from-sharepoint-api March 23, 2021 at 09:18AM

没有评论:

发表评论