Getting the data - i cant do it

Im on the exercise of “Creating Data” and i literally dont know how to make the for of loop, can somebody explain me how to do it? im literally stuck and really frustrated

let title = document.createElement(‘h1’);
title.textContent = ‘Adoptable Animals’;
document.body.appendChild(title);

import {animals} from ‘./animalShelter.data’;

let animalName = document.createElement(‘h2’);

that is what i made and its wrong

import { animals } from ‘animalShelter.data’;

let title = document.createElement(‘h1’);
title.textContent = ‘Adoptable Animals’;
document.body.appendChild(title);

for (let animal of animals) {
let animalName = document.createElement(‘h2’);
animalName.textContent = animal[0];

document.body.appendChild(animalName);

}

Try this. It worked for me. I hope it works for you too!

1 Like