I have the following JSON:
{
title: 'title',
...,
order: 0
}, {
...,
order: 9
}, {
...,
order: 2
}
... the JSON includes many fields, how can I sort them based on the order field?
I was looking for something build into nodejs but I couldn't find anything that might be useful for that case.
arr.sort(function (a, b) { return a.order - b.order; })
- that was hard.