Answer the question
In order to leave comments, you need to log in
How to correctly compare arrays and replace if the key matches?
Hello. There are 2 arrays.
In the first array - a range of dates and zero values, in the second - an array of some dates with positive values.
array1 =[];
array1.push(['Days', 'Sales', 'Expenses']);
array1.push(["2018-07-10",0,0]);
array1.push(["2018-07-11",0,0]);
array1.push(["2018-07-12",0,0]);
array1.push(["2018-07-13",0,0]);
array1.push(["2018-07-14",0,0]);
array1.push(["2018-07-15",0,0]);
array1.push(["2018-07-16",0,0]);
array2 =[];
array2.push(['Days', 'Sales', 'Expenses']);
array2.push(["2018-07-10",3,580]);
array2.push(["2018-07-13",1,1200]);
array2.push(["2018-07-16",6,160]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question