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

Unable to pass the challenge because I changed the original code

I am trying to run my code but it says u have changed the original code. If that is the case, how am I suppose to the new array in abbreviatedDays, If I use push, even than I need to make the abbreviatedDays as a empty array?

app.js
const daysOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
let abbreviatedDays = daysOfWeek.map((days)=>{
   days.slice(0,3);
  })

1 Answer

Steven Parker
Steven Parker
229,657 Points

You should write all the new code below the comment line. You won't need to declare the output variable since that's done in the supplied code. Just assign it.

You have the right idea for your solution, but when you use the long form of an arrow function (with the body in braces), you need to return the result. You could also use the compact form here and the result is implicitly returned.