Change $.each for js for