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 trialpakarang buacharoen
Full Stack JavaScript Techdegree Student 1,897 PointsI think the console.log line was where I went wrong, but I can't seems to figure out how to solve it
Use the array method that combines all of the elements inside the planets array into a single string.
const planets = ['Earth','Mars','Saturn','Mercury','Jupiter','Venus','Uranus','Neptune'];
planets.join(', ');
console.log(i);
2 Answers
Steven Parker
231,172 PointsYou haven't defined anything named "i". Did you mean to create a new variable by that name on line 2 and assign the joined string to it?
Fayez Mamdoh
2,530 Pointsconst planets = [
"Earth",
"Mars",
"Saturn",
"Mercury",
"Jupiter",
"Venus",
"Uranus",
"Neptune",
];
console.log(planets.join(", "));
console.log(planets);
Steven Parker
231,172 PointsYes, you can skip creating the variable. But you don't need that last line, logging the original list isn't part of the challenge.