Say I have this:
var arr = [
{type:"orange", title:"First"},
{type:"orange", title:"Second"},
{type:"banana", title:"Third"},
{type:"banana", title:"Fourth"}
];
And I'd like to get to this.
[[{type:"orange", title:"First"},
{type:"orange", title:"Second"}],
[{type:"banana", title:"Third"},
{type:"banana", title:"Fourth"}]]
I've seen a lot for getting to this:
{orange:
[[{type:"orange", title:"First"},
{type:"orange", title:"Second"}],
banana:
[{type:"banana", title:"Third"},
{type:"banana", title:"Fourth"}]}
But it doesn't help my situation, I need it to be arrays inside an array. Any help will be greatly appreciated