created a while loop with inline JS