const subjects = [
{ "name": "Math", "score": 81 },
{ "name": "English", "score": 77 },
{ "name": "Chemistry", "score": 87 },
{ "name": "Physics", "score": 84 }
];
// Sort in ascending order - by name
subjects.sort((a, b) => (a.name > b.name) ? 1: -1);
console.log(subjects);