Split String Into Substrings Javascript Interview Programming