While Loop Through Array Javascript Mdn Addeventlistener