diff --git a/snippets/hide.md b/snippets/hide.md index ea197954a..a80888583 100644 --- a/snippets/hide.md +++ b/snippets/hide.md @@ -5,9 +5,9 @@ Hides all the elements specified. Use the spread operator (`...`) and `Array.forEach()` to apply `display: none` to each element specified. ```js -const hide = el => [...el].forEach(e => (e.style.display = 'none')); +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 ```