JSFiddle - React, Tailwind, and code Playground
JavaScript
//
// Unstable Sorting Example
// Need to be run in a browser that uses unstable sort alghoritm (e.g. Chrome)
//
// A list that needs to be sorted by `score` property
var x = [
{"name":"A", "score":1},
{"name":"B", "score":1},
{"name":"C", "score":1},
{"name":"D", "score":1},
{"name":"E", "score":1},
{"name":"F", "score":1},
{"name":"H", "score":1},
{"name":"I", "score":1},
{"name":"J", "score":1},
{"name":"K", "score":1},
{"name":"L", "score":1},
{"name":"M", "score":1}
];
// sorting
x.sort(function(a, b) { return a.score < b.score ? -1 : (a.score > b.score ? 1 : 0); });
// Output
// console.log(x);
x.forEach(function(rec, i) {
document.write(rec.name + '<br/>');
});
/*
*Since the `score` value is the same for all elements you could expect the output to be 'A B C D E ...', but it's not the case with unstable sort
*/