Skip to content

Latest commit

 

History

History

sortArrayByStringLength

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Sort array by string length

7 kyu link to kata
my solution

Write a function that takes an array of strings as an argument and returns a sorted array containing the same strings, ordered from shortest to longest.

For example, if this array were passed as an argument:

["Telescopes", "Glasses", "Eyes", "Monocles"]

Your function would return the following array:

["Eyes", "Glasses", "Monocles", "Telescopes"]

All of the strings in the array passed to your function will be different lengths, so you will not have to decide how to order multiple strings of the same length.