N
The first example will not work as the el parameter will be an Array containing one element, a NodeList . The forEach will be called once, e will be a NodeList which does not have a syle property, so will result in a Uncaught TypeError: e.style is undefined error. The following will work, which will, via the spread operator, convert the NodeList into an Array , thus giving access to the forEach method. const hide = (...el) => el.forEach(e => (e.style.display = 'none' )); // Example hide (... document . querySelectorAll ( 'img' )); // Hides all <img> elements on the page