1

I have an object array of the form

  var arrayA = [
          {value:3000, date:"01/01/2020"},
          {value:4000, date:"02/13/2020"},
          {value:5500, date:"01/01/2020"},
          {value:2300, date:"03/03/2020"},
          {value:1200, date:"02/13/2020"},
          {value:4000, date:"03/03/2020"}
         ];

I want to add values that have the same date and come up with a new array as below.

var _new_arrayA = [
       {value:8500, date:"01/01/2020"},
       {value:5200, date:"02/13/2020"},
       {value:6300, date:"03/03/2020"}
     ];

I do not know where to start, therefore i don't have any implementation code

Nikola Lukic
  • 4,001
  • 6
  • 44
  • 75
Steve Gaita
  • 151
  • 2
  • 11
  • You've shown how the array starts (a), and the expected result (b) but not what gets you from a -> b. – Jamiec Jan 13 '20 at 12:20
  • With `add values` you mean change the value? It's pretty unclear what's your exact problem is. Just use `find` to find one object, then change the value. – Lux Jan 13 '20 at 12:22

0 Answers0