While Loop Through String Javascript Substring Until Character