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 trialHanna Reed
3,849 Pointsuse array that combines string
I can't figure this out, I logged to the console, combined each item, but nothing works.
var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
months.join(', ');
console.log(months[0]);
console.log(months[1]);
console.log(months[2]);
console.log(months[3]);
console.log(months[4]);
console.log(months[5]);
console.log(months[6]);
console.log(months[7]);
console.log(months[8]);
console.log(months[9]);
console.log(months[10]);
console.log(months[11]);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
2 Answers
Susannah Klanecek
5,825 PointsDon't log them seperately, just wrap your original join method with console log and it will work:
console.log(months.join(', '))
Steven Parker
231,269 PointsThe instructions say, "Finally, log the final string value to the console.", but you logged the individual original parts instead.
Just log the result of the join.