What is wrong in this Javascript function? /** * Adds event listeners * @param {string} id element's id * @param {function} callback function to be run on click * @param {string} eventType defaults to...


What is wrong in this Javascript function?


/**
* Adds event listeners
* @param {string} id element's id
* @param {function} callback function to be run on click
* @param {string} eventType defaults to click, but can be any event type
*/
const addListener = (id, callback, eventType = 'click') => {
document.getElementsById(id).addEventListener(eventType, callback);
};



Any help is appreciated!!



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here