Files
30-seconds-of-code/snippets/show.md
Isabelle Viktoria Maciohsek 5cb69e3c5c Update snippet descriptions
2020-10-22 20:24:30 +03:00

384 B

title, tags
title tags
show browser,css,beginner

Shows all the elements specified.

  • Use the spread operator (...) and Array.prototype.forEach() to clear the display property for each element specified.
const show = (...el) => [...el].forEach(e => (e.style.display = ''));
show(...document.querySelectorAll('img'));
// Shows all <img> elements on the page