TypeScript: ForEach Sum Field in Items of an Array

Posted by Unknown On Thursday, June 29, 2017 3 comments

  public getTotalWeight(): number {
    var total = 0;
    if (this.items != null && this.items.length > 0) {      
      this.items.forEach(x => total += x.weight);
    }
    return total;
  }  

3 comments:

Praveen said...

Thank You so much...

Unknown said...

Thank You, you helped me

Anonymous said...

Best baccarat tables - Wolione
The game of baccarat 메리트카지노총판 has its origins in the Spanish. The book is 바카라 사이트 one of the oldest and most respected European 샌즈카지노 There is also the Betfair Blackjack,

Post a Comment