How to sum the values ​​of the properties of nested objects?

  • 0
    https://jsfiddle.net/bmyt1p4n/
    how to address by key (quantity), you need to calculate the total.
    JavaScript Daniel Huang, Sep 1, 2019

  • 1 Answers
  • 0
    Object.values(cart).reduce((acc, n) => acc + n.quantity, 0)
    Arianna Taylor

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!