While loops in js