You are viewing a single comment's thread. Return to all comments →
A bit leaner solution without all of the extra test conditions.
function bigSorting(arr) { const results = arr.sort((a,b) => { if(a.length !== b.length){ return a.length - b.length; } else{ for(let i = 0; i < a.length; i++){ if(parseInt(a[i]) !== parseInt(b[i])){ return parseInt(a[i]) - parseInt(b[i]); } } } }); return results; }
Seems like cookies are disabled on this browser, please enable them to open this website
Big Sorting
You are viewing a single comment's thread. Return to all comments →
A bit leaner solution without all of the extra test conditions.