prefer addEventListener in this JS example