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; ...
Markdown supported · ⌘↵ to post
No responses yet.