diff --git a/snippets/hide.md b/snippets/hide.md index a80888583..3c396cec4 100644 --- a/snippets/hide.md +++ b/snippets/hide.md @@ -2,12 +2,12 @@ Hides all the elements specified. -Use the spread operator (`...`) and `Array.forEach()` to apply `display: none` to each element specified. +Use `NodeList.prototype.forEach()` to apply `display: none` to each element specified. ```js -const hide = (...el) => [...el].forEach(e => (e.style.display = 'none')); +const hide = els => els.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 ``` diff --git a/test/hide/hide.js b/test/hide/hide.js index 0d4044db0..21099679b 100644 --- a/test/hide/hide.js +++ b/test/hide/hide.js @@ -1,2 +1,2 @@ -const hide = (...el) => [...el].forEach(e => (e.style.display = 'none')); +const hide = els => els.forEach(e => e.style.display = 'none'); module.exports = hide;