How do you sort a list of words on the 4th character of the word? What"s the shortest solution?
[ "strawberry", "helicopter", "wales", "acorn" ]
should be:
[ "strawberry", "wales", "helicopter", "acorn" ]
// str_a_berry, wal_e_s, hel_i_copter, aco_r_n
You can use this dataset to test.
Something along the lines:
What happens when the word is smaller than 4 characters? I'm using a regular sort method, but I'll leave that to you because I don't know your exact requirements.