Update javascript.js

remove for loop to stop endless flipping