While Loop Through String Javascript Definition