Freecodecamp: Challenge Waypoint: Filter Arrays with filter has an issue.

Created on 30 Oct 2015  ·  3Comments  ·  Source: freeCodeCamp/freeCodeCamp

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

Most helpful comment

Hi it must be:

return val < 6 === true;

All 3 comments

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;

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ar5had picture ar5had  ·  3Comments

SaintPeter picture SaintPeter  ·  3Comments

kokushozero picture kokushozero  ·  3Comments

danielonodje picture danielonodje  ·  3Comments

Akshit-p picture Akshit-p  ·  3Comments