Amandeep Pasricha14,931 Points
Instead of using a loop, couldn't you have used query selector all and then apply the click event on all of these?
I feel like the only reason we are doing a loop is because we only selected one li element. If we selected all, would we not have to worry about the loop?
Steven Parker203,261 Points
A NodeList has no method to apply a listener to each of its members, but by looping though them, you can add a listener to each one individually.