loading...

re: Daily Challenge #245 - Sort Santa's Reindeer VIEW POST

FULL DISCUSSION
 

ES6


const sort_reindeer = (list)  => [...list].sort((a,b) => {
 const [, surname1] = a.split(" ")
 const [, surname2] = b.split(" ")

 if(surname1 > surname2) return 1;
 if(surname2 > surname1) return -1;
 return 0;

})


code of conduct - report abuse