Update hide.md

This commit is contained in:
Angelos Chalaris
2018-01-08 12:41:36 +02:00
committed by GitHub
parent 3376f8350d
commit 96057709a1

View File

@ -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 <img> elements on the page
hide(...document.querySelectorAll('img')); // Hides all <img> elements on the page
```