Getting the Data explainer

Aim of the puzzle: Use JavaScript to import an array of animals and add the name of each animal to your webpage.

Walk through of solution: Start the puzzle by adding import { animals } from 'animalShelter.data' to the top of the JS tab. animals is an array containing arrays.

Then, add a for loop to iterate through animals, for example: for (let animal of animals)

Inside the for loop, use document.createElement() to create a new h2 element, and store this in a variable named animalName.

Then, set the .textContent of animalName to animal[0]. Finally, use the .appendChild() method to add animalName to the body.

Javascript Concepts: Document object, document.createElement, document.body. .appendChild(), For Loops