I have an array of objects. For eg-
[{
aKey:2,
bKey:2,
cKey:3
}, {
bKey:2,
cKey:6
}, {
aKey:1,
bKey:6,
cKey:5
}, {
bKey:1,
cKey:4
}, {
bKey:6,
cKey:7
}]
So what I need to do is-
- First sort the array on the basis of aKey (asc order) and the objects which are having this key would be at the beginning in result array.
- Then I need to sort the array based on the value of bKey. for eg, all the records having bKey = 2, would be at the beginning.
- Rest records would be sorted based on the value of cKey in asc order.
So the output will be-
[{
aKey:1,
bKey:6,
cKey:5
}, {
aKey:2,
bKey:2,
cKey:3
}, {
bKey:2,
cKey:6
}, {
bKey:1,
cKey:4
}, {
bKey:6,
cKey:7
}]
bKey:1followingbKey:2at expected output? Sort is based oncKey?