Challenge Waypoint: Filter Arrays with filter has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
.
It asked me to use filter to remove all elements from array that are greater than 5. When I run test with my code, the result I got is true but it didn't let me pass.
My code:
var oldArray = [1,2,3,4,5,6,7,8,9,10];
// Only change code below this line.
var newArray = oldArray.filter(function(val){
return val < 5 === true;
});
// Only change code above this line.
(function() { return newArray; })();
Looks like your code isn't just removing values greater than 5, it is also removing 5.
Closing as not an issue with the tests but feel free to reply if you need further clarification.
Thanks and happy coding!
Oh I see, thank you!
Hi it must be:
return val < 6 === true;
Most helpful comment
Hi it must be:
return val < 6 === true;