Created
May 20, 2020 20:45
-
-
Save venelrene/da7d558f0c2e61d797cdbc917c8e8848 to your computer and use it in GitHub Desktop.
Suzuki needs help lining up his students! Today Suzuki will be interviewing his students to ensure they are progressing in their training. He decided to schedule the interviews based on the length of the students name in descending order. The students will line up and wait for their turn. You will be given a string of student names. Sort them an…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lineupStudents(names){ | |
return names.trim().split(" ").sort((a,b) => | |
a.length - b.length || a.localeCompare(b)).reverse() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment