Correct: `Array.from()` (it’s a static method) Incorrect: `Array.join()` (doesn’t exist; it’s a prototype method) This patch uses the common `#` syntax to denote `.prototype.`.
14 lines
344 B
Markdown
14 lines
344 B
Markdown
### show
|
|
|
|
Shows all the elements specified.
|
|
|
|
Use the spread operator (`...`) and `Array.prototype.forEach()` to clear the `display` property for each element specified.
|
|
|
|
```js
|
|
const show = (...el) => [...el].forEach(e => (e.style.display = ''));
|
|
```
|
|
|
|
```js
|
|
show(...document.querySelectorAll('img')); // Shows all <img> elements on the page
|
|
```
|