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 trialTadjiev Codes
9,626 PointsWhat does thumbnail mean in this AJAX video?
What does thumbnail mean in this AJAX video?
function generateHTML(data) {
const section = document.createElement('section');
peopleList.appendChild(section);
section.innerHTML = `
<img src=${data.thumbnail.source}>
<h2>${data.title}</h2>
<p>${data.description}</p>
<p>${data.extract}</p>
`;
}
The line
${data.thumbnail.source}
I understand that it gets the image. IS the thumbnail or source are the names of the property in JSON? Like in the next lines he's accessing title, description, and so on.
1 Answer
Tim Oltman
7,730 PointsHi Tadjiev,
thumbnail is an object nested within data. It probably looks something like this:
data = {
title: "The Title",
description: "This is the description",
extract: "The extract value",
thumbnail: {
source: "http://image.source.com",
otherProp: 5
}
}