Files
30-seconds-of-code/snippets/show.md
2022-02-13 19:19:45 +02:00

469 B

title, tags, firstSeen, lastUpdated
title tags firstSeen lastUpdated
Show elements browser,css,beginner 2017-12-28T23:33:21+02:00 2020-10-22T20:24:30+03:00

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