While Loop Through String Javascript Definition Functions