Am not able find logic, Here I need arrange the below data into multidimensional with matrix format,
var data = [
{
"matrixData":[8,0],
"x":8,
"y":0,
},
{
"matrixData":[0,4],
"x":0,
"y":4,
},
{
"matrixData":[4,0],
"x":4,
"y":0,
},
{
"matrixData":[0,0],
"x":0,
"y":0,
},
{
"matrixData":[4,4],
"x":4,
"y":4
}
]
into following order based on row column wise, Expected Result
var data = [
[
{
"matrixData":[0,0],
"x":0,
"y":0,
},
{
"matrixData":[4,0],
"x":4,
"y":0,
},
{
"matrixData":[8,0],
"x":8,
"y":0,
},
],
[
{
"matrixData":[0,4],
"x":0,
"y":4,
},
{
"matrixData":[4,4],
"x":4,
"y":4
}
]
]
here x is row and y is column, is there any possible by using sort method or underscore.js