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
Ben Os
20,008 PointsArray mapped and filtered basically correct, but answer still wrong
In this question:
Using the filter and map methods on the todos array, create an array of unfinished task strings. See the comments below to see the correct result. Store the new array in the variable unfinishedTasks.
I did:
unfinishedTasks = todos.map( (e)=> e).filter( (e)=> e.done == false);
The output is basically similar to the desired answer: ["Buy apples", "Write web app", "Call mom"] which are all "unifished tasks" I've been asked to filter out... So why the answer fails?
1 Answer
stjarnan
Front End Web Development Techdegree Graduate 56,488 PointsHi Ben,
What they want you to do is to use filter first, that way you only map the part of the array you actually want to keep. I think this might help you back into the right direction, let me know if you need more help :)
Jonas
Seth Kroger
56,416 PointsSeth Kroger
56,416 PointsI don't know why this is downvoted. The output wants you do discard everything but the string, but you can't filter it if you discard the done status so it has to come first.