Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Sorting the Odd way!

function sortItOut(array){
  return array.filter(a => Math.floor(a) % 2 !== 0).sort((a,b) => a - b)
  .concat(array.filter(a => Math.floor(a) % 2 === 0).sort((a,b) => b - a))
}
 
PREVIOUS NEXT
Tagged: #Sorting #Odd
ADD COMMENT
Topic
Name
9+5 =