diff --git a/snippets/hide.md b/snippets/hide.md index 89a544d39..fc9d6dd9b 100644 --- a/snippets/hide.md +++ b/snippets/hide.md @@ -7,12 +7,12 @@ lastUpdated: 2020-09-15T16:28:04+03:00 Hides all the elements specified. -- Use `NodeList.prototype.forEach()` to apply `display: none` to each element specified. +- Use the spread operator (`...`) and `Array.prototype.forEach()` to apply `display: none` to each element specified. ```js const hide = (...el) => [...el].forEach(e => (e.style.display = 'none')); ``` ```js -hide(document.querySelectorAll('img')); // Hides all elements on the page +hide(...document.querySelectorAll('img')); // Hides all elements on the page ```