Created
January 2, 2022 22:47
-
-
Save marcinantkiewicz/56da1b7fadec3dfccbc51bee2c914a7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// note: document.get_elementByTagName returns HTMLCollection which is not an array, and does not implement foreach(). | |
// ... turns htmlcolleciton into an array. Array.from(a) would do same here. | |
// This also an example of design decision that did not age well. | |
// ref: https://stackoverflow.com/questions/22754315/for-loop-for-htmlcollection-elements/22754453 or so. | |
[...document.getElementsByTagName('img')].forEach(a=>console.log(a.style.visibility='hidden')) | |
[...document.getElementsByTagName('img')].forEach(a=>console.log(a.style.height='100px')) | |
[...document.getElementsByTagName('img')].forEach(a=>my_function(a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment