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 trial

JavaScript JavaScript Array Iteration Methods Array Manipulation Practice map()

I know this works but why can't I submit it? Is this a bug or am I missing something?

This happened on the previous code challenge as well. It won't let me alter the code on line two that's already written, and I can't use let to restate the abbreviatedDays Variable. Am I missing something here?

app.js
const daysOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
let abbreviatedDays;

// abbreviatedDays should be: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
// Write your code below

let abbreviatedDays = daysOfWeek.map(day => day.substr(0,3));

1 Answer

Since abbreviatedDays is already declared, you just need to use it.

abbreviatedDays = daysOfWeek.map(day => day.substr(0,3));

That will pass.