I corrected the function name by appending “All” to its end. Your comment and Bob’s has inspired me to improve the copy. Thank you.

The basic idea was to give the programmer the choice to use any of these three functions, that can be used together with Object.entries to output the list of selected elements:

let div1 = document.getElementsByClassName("image");
let div2 = document.getElementsByTagName("div");
let div3 = document.querySelectorAll("div");
Object.entries(div1).map(( object ) => { console.log( object ) });
Object.entries(div2).map(( object ) => { console.log( object ) });
Object.entries(div3).map(( object ) => { console.log( object ) });

As a JavaScript programmer for many years I still struggle with remembering all the possible function names, objects they return and so forth.

It’s so basic (but nonetheless, a useful example) that I failed to edit as I was writing it. I’m thankful for this iterative content improvement (over a period of time) idea that I learned from other software engineers.

Written by

Issues. Every webdev has them. Published author of CSS Visual Dictionary https://amzn.to/2JMWQP3 few others…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store