Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
220,501 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.