I have this array.object
and I need to reorder it so that if it has an empty displayOrder
it will be last considering the type.
[
{
"displayOrder": "",
"type": "moment",
},
{
"displayOrder": "2",
"type": "moment",
},
{
"displayOrder": "4",
"type": "moment",
},
{
"displayOrder": "1",
"type": "presentation",
}
]
//Reorder to this:
[
{
"displayOrder": "2",
"type": "moment",
},
{
"displayOrder": "4",
"type": "moment",
},
{
"displayOrder": "",
"type": "moment",
},
{
"displayOrder": "1",
"type": "presentation",
}
]
What could I do to achieve this?