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 Combining Array Methods Method Chaining

Kei Lau
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Kei Lau
Full Stack JavaScript Techdegree Graduate 17,534 Points

I think everything with my code is right, and the Bummer says I have changed the provided code.

I think everything with my code is right, and the Bummer says I have changed the provided code. But it doesn't make sense not to change the code I think. Can any one help me? Thank you.

app.js
const years = [1989, 2015, 2000, 1999, 2013, 1973, 2012];
let displayYears = years
    .filter(year => year > 2000)
    .map(year => year + ' A.D.');


// displayYears should be: ["2015 A.D.", "2013 A.D.", "2012 A.D."]
// Write your code below

1 Answer

Joel Bardsley
Joel Bardsley
31,249 Points

Your code will pass the challenge, you just have to leave displayYears undefined on Line 2, and assign your answer to it below the commented lines.

In a real world scenario, you wouldn't have to do this, but I assume it was necessary for the teacher to do so when setting up the code challenge.