Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
This video covers one solution to the challenge.
Code Snippets
The planets
array:
const planets = [
{
name: 'Saturn',
diameter: '72,367.4 mi',
moons: '62',
temp: '-178 °C',
orbitDays: '10,756',
orbitYears: '29.5',
description: 'Saturn is the sixth planet from the Sun and the most distant that can be seen with the naked eye. Saturn is the second largest planet and is best known for its fabulous ring system that was first observed in 1610 by the astronomer Galileo Galilei.',
facts: 'Saturn was known to the ancients, including the Babylonians and Far Eastern observers. It is named for the Roman god Saturnus, and was known to the Greeks as Cronus.'
},
{
name: 'Mars',
diameter: '4,212 mi',
moons: '2',
temp: '-153 to 20 °C',
orbitDays: '687',
orbitYears: '1.9',
description: `The fourth planet from the Sun and the second smallest planet in the solar system. Named after the Roman god of war, Mars is also often described as the “Red Planet” due to its reddish appearance. It's a terrestrial planet with a thin atmosphere composed primarily of carbon dioxide.`,
facts: 'Mars has the largest dust storms in the solar system. They can last for months and cover the entire planet. On Mars the Sun appears about half the size as it does on Earth.'
}
];
Map through the planets
array and return a card for each object in the array:
document.querySelector('body').innerHTML = planets.map(planet => createPlanetHTML(planet)).join('');
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Peter Huang
5,427 Points0 Answers
-
Yazeed Hani
5,002 Points0 Answers
-
Terence Fong
1,499 Points2 Answers
-
Carl Dawkins
Web Development Techdegree Student 5,190 Points1 Answer
-
Gerald Susanteo
Front End Web Development Techdegree Student 7,117 Points2 Answers
-
ja5on
10,338 Points1 Answer
-
ja5on
10,338 Points1 Answer
-
ja5on
10,338 Points1 Answer
-
Mahmoud Nasser
5,507 Points3 Answers
-
M Khan
7,024 Points2 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up