loops and js