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

2
  • You've shown how the array starts (a), and the expected result (b) but not what gets you from a -> b. Commented Jan 13, 2020 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. Commented Jan 13, 2020 at 12:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.