sort objects in array js
function createDropDowns() {
for (const [key, val] of Object.entries($pgns["nmea2000"])) {
pgnList = [...pgnList, val];
fieldsList[val.title] = val.fields;
fieldsListOut[val.title] = val.fields;
}
pgnList.sort((a, b) =>
a.title > b.title ? 1 : b.title > a.title ? -1 : 0
);
}
pgnList = [
{pgn: '065280', manufacturer: '161', title: 'Proprietary - Set Serial Number', fields: Array(6), route: '/nmea2000/data/{busNumber}/by_instance/{instance}/065280/{field}'}
{pgn: '065280', manufacturer: '257', title: 'Engine Status Parameters, Dynamic', fields: Array(10), route: '/nmea2000/data/{busNumber}/by_instance/{instance}/065280/{field}'}
{pgn: '065284', manufacturer: '257', title: 'Display Communication Status', fields: Array(12), route: '/nmea2000/data/{busNumber}/by_instance/{instance}/065284/{field}'}
{pgn: '065289', manufacturer: '161', function: '1', title: 'Proprietary - Set Volume and Capacity', fields: Array(8), …}
{pgn: '065289', manufacturer: '161', function: '2', title: 'Proprietary' }
]