I created the following Chrome bookmarklet to open all Extra Examples boxes on this page:
Do you see any problem, or can it be improved?
You can also call
.forEach directly on the result of
querySelectorAll. No need to wrap it in
Thanks for the answer! Why can’t I get the same result using
Because that returns a HTMLCollection that doesn’t have a forEach method.
getElementsByClassName is an older standard, for which the array-like method of forEach didn’t exist at the time.