While loop in JS