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 trialDavid Aguirre
8,170 PointsIs this exercise broken? I have joined all the strings and have done the console.log(months.pop())method
var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
months.join(', '); console.log(months.pop())
Is not working
var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
months.join(', ');
console.log(months.pop())
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
3 Answers
Brandon Leichty
Full Stack JavaScript Techdegree Graduate 35,193 PointsHey David,
You're very close. Try creating a new variable to store the combined months in. Something like:
var combinedMonths = months.join(', ');
Then log that to the console.
Part of the reason you want to do this to preserve the array of months, while creating a new variable that holds the months in a single string.
Hope that helps! Let me/us in the Treehouse community know if you need more help! 🙌
-Brandon
KRIS NIKOLAISEN
54,971 PointsWhy are you using months.pop()? You are just supposed to log the string.
David Aguirre
8,170 PointsHi there, thanks for your answers. I think I didn't read well the instructions. Sorry for the inconvenience.
Brandon Leichty
Full Stack JavaScript Techdegree Graduate 35,193 PointsNo inconvenience at all! That's what the community here is for.