function fn(students){ students.sort(function(a,b){ return a.class!==b.class?a.class -b.class:b.score - a.score }) return JSON.stringify(students) }