Sort list of numbers in Javascript without using the sort method.
function sortNumbers() {
return arr.reduce((acc, value) => {
const nextIndex = acc.findIndex(num => value > num);
const index = nextIndex > -1 ? nextIndex : acc.length;
acc.splice(index, 0, value);
return acc;
...
jkpulipati.hashnode.dev1 min read