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()

map() with template literals in JavaScript

Hi there,

I'm doing the following challenge: https://teamtreehouse.com/library/javascript-array-iteration-methods/array-manipulation/practice-map

My code is not passing: abbreviatedDays = daysOfWeek.map(day => `${day[0]}${day[1]}${day[2]}`);

I tested it elsewhere and it outputs the correct result, ['Sun', 'Mon', 'Tue', ... etc]

Any idea what I'm missing?

Thanks

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
abbreviatedDays = daysOfWeek.map(day => `${day[0]}${day[1]}${day[2]}`);

1 Answer

Steven Parker
Steven Parker
231,236 Points

Apparently, this challenge doesn't allow template literals. Try using concatenation instead.

If you consider this a bug, you might want to report it to the Support folks.

Thanks. Concatenation did indeed work. With that being the case, I can't see why template literals wouldn't. Will shoot them a message