Created a do-while loop in js