I have an array that I need to split into an array of arrays. I've seen a lot on grouping, splitting, sorting, etc... but these all create separate arrays. I need to keep the one array.
data = [
{
CustAccount: 'FEN000',
JobNumber: 1026704,
Open: 1
},
{
CustAccount: 'FEN000',
JobNumber: 1026556,
Open: 47
},
{
CustAccount: 'FEN000',
JobNumber: 1026627,
Open: 11
},
{
CustAccount: 'FEN000',
JobNumber: 1026627,
Open: 33
},
{
CustAccount: 'FEN000',
JobNumber: 1026627,
Open: 17
},
{
CustAccount: 'FEN000',
JobNumber: 1026627,
Open: 2
}
]
I need to create a new array that puts objects into a subarray based off the range of Open < 11, 11 - 29, 30+ using javascript.
newdata = [
[{
CustAccount: 'FEN000',
JobNumber: 1026704,
Open: 1
},
{
CustAccount: 'FEN000',
JobNumber: 1026556,
Open: 2
}
]
[
{
CustAccount: 'FEN000',
JobNumber: 1026627,
Open: 11
},
{
CustAccount: 'FEN000',
JobNumber: 1026627,
Open: 17
}
]
[
{
CustAccount: 'FEN000',
JobNumber: 1026627,
Open: 33
},
{
CustAccount: 'FEN000',
JobNumber: 1026627,
Open: 47
}
]
]
Any help would be appreciated
open. Then concatenate the arrays.