solved JS Loops