Simplify hide
This commit is contained in:
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
Hides all the elements specified.
|
Hides all the elements specified.
|
||||||
|
|
||||||
Use the spread operator (`...`) and `Array.forEach()` to apply `display: none` to each element specified.
|
Use `Array.forEach()` to apply `display: none` to each element specified.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const hide = (...el) => [...el].forEach(e => (e.style.display = 'none'));
|
const hide = els => els.forEach(e => e.style.display = 'none');
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```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;
|
module.exports = hide;
|
||||||
|
|||||||
Reference in New Issue
Block a user