I'm new to node.js. Here is my code:
My Code
More specifically, here is what I have for JS:
let torontoTeams = [
{"name": "Raptors", "description": "The Raptors compete in the National Basketball Association (NBA), as a member club of the league's Eastern Conference Atlantic Division."},
{"name": "Maple Leafs", "description": "The Maple Leafs are one of the 'Original Six' NHL teams, and have won the Stanley Cup 13 times."},
{"name": "Blue Jays", "description": "The Blue Jays compete in Major League Baseball (MLB) as a member club of the American League (AL) East division."}
];
for (let i=0; i < torontoTeams.length; i++) {
let newSection = document.createElement('section');
document.appendChild(newSection);
let newTeam = document.createElement('h1');
newTeam.appendChild(document.createTextNode(torontoTeams[i].name));
let newDesc = document.createElement('P');
newDesc.appendChild(document.createTextNode(torontoTeams[i].description));
document.createElement(newSection);
newSection.appendChild(newTeam);
newSection.appendChild(newDesc);
};
I'm not sure where I'm going wrong with creating the HTML elements.
document.createElement(newSection);.createElement()takes a tagName as the argument, not a DOM element and you want to put the section intodocument.body, notdocument.