There is a model in an array, like this:
model1.date = 2016.4.12 8:25 model2.date = 2016.4.12 9:20 model3.date = 2016.3.13 8:30 model4.date = 2016.3.11 8:15 model5.date = 2015.2.12 1:20 model6.date = 2015.2.12 2:25
What needs to be done now is to put those with the same date into an array and those without the same date into an array. The final array to be obtained should look like this:
[model1,model2], [model3], [model4], [model5,model6],
Excuse me, how should I do it?
Is this json? Direct
Then walk through this list.
Determines whether keymap[item.date] is undefined.
Yes, it is assigned to an array
No, just push the iteminto it.
Finally, it traverses a keymap and pushes all values into a list.