Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.
Well done!
You have completed (UPI) Chapter 9: Understanding the Document Object Model (DOM) with JavaScript!
Instruction
Using Tag Names
Another way to find elements on an HTML page is the getElementsByTagName method. It accepts a tag name, e.g., 'h1', 'div', or 'p', and returns all such elements in an array.
Here, we use the method to retrieve an array of all 'div' elements.
function show() {
"use strict";
// if you want to search in the complete document, you must specify 'document'
let elemArray = docu...