JSFiddle - React, Tailwind, and code Playground
JavaScript
var myArr = [{
id: 1,
name: "Player 1",
total: 20
}, {
id: 2,
name: "Player 2",
total: 60
}, {
id: 3,
name: "Player 3",
total: 80
}, {
id: 4,
name: "Player 4",
total: 400
}, {
id: 5,
name: "Player 5",
total: 150
}, {
id: 6,
name: "Player 6",
total: 50
}];
myArr.sort(function (a, b) {
return a.total < b.total;
});
console.log(myArr);