Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRyan Soeder
11,056 PointsClean console but nothing printing to web page.
Having a hard time understanding why nothing is displaying.
let students = [
{
name: `Francis`,
track: `FEWD`,
acheivements: 58,
points: 987,
},
{
name: `Hermon`,
track: `JavaScript`,
acheivements: 34,
points: 234,
},
{
name: `Banana`,
track: `Python`,
acheivements: 324,
points: 23,
},
{
name: `Jesse`,
track: `Ruby`,
acheivements: 234,
points: 3434,
},
{
name: `Adam`,
track: `Scala`,
acheivements: 324234,
points: 4322342,
}
];
function print(message) {
let output = document.getElementById(`output`);
output.inerHTML = message;
}
function buildList() {
let list = ``;
for (let i = 0; i < students.length; i++) {
list += `<ul>`;
list += `<li><strong>${students[i].name}</strong></li>`;
list += `<li>${students[i].track}</li>`;
list += `<li>${students[i].acheivements}</li>`;
list += `<li>${students[i].points}</li>`;
list += `</ul>`;
}
return list;
}
print(buildList());
Any help appreciated, thanks!
3 Answers
Rich Donnellan
Treehouse Moderator 27,708 PointsTypo.
- output.inerHTML = message;
+ output.innerHTML = message;
Grzegorz Zielinski
5,838 PointsHello :)
You've made a spelling mistake in this bit of code:
function print(message) {
let output = document.getElementById(`output`);
output.inerHTML = message;
}
To be precised - it should be "innerHTML", not "inerHTML".
I hope it helps!
Ryan Soeder
11,056 PointsThank you so much, wonderful people!
Rich Donnellan
Treehouse Moderator 27,708 PointsNo problem.
FYI — I debugged by pasting your code right into Chrome's Dev Tools console. It came back with this error which was easy to pinpoint the mistake:
VM4561:37 Uncaught TypeError: Cannot set property 'inerHTML' of null
at print (<anonymous>:37:19)
at <anonymous>:54:1