7 kyu

The reject() function

3,171 of 4,303user5363957
Description
Loading description...
Arrays
Fundamentals
  • Please sign in or sign up to leave a comment.
  • AbdallahSiyabi Avatar

    I like this kata. Thanks

  • user4896126 Avatar

    very nice one thx

  • Heathro Avatar

    very useful kata. makes me learn something new. thank you

  • celyes Avatar
    • The instructions aren't clear
    • There aren't enough test cases
    • The purpose behind the challenge is useless in general.

    I suggest improving the instructions and adding more test cases

  • CrusherCL Avatar

    There is a problem writing instructions?

  • Hvuj Avatar

    This comment has been hidden.

  • gitriyad Avatar

    Sorry to say, this is the most unclear kata i have ever seen. Please add some clearer description, such as the reject function needs to reject the iterator function.

  • FArekkusu Avatar

    The description is non-existent.

  • AJFarmar Avatar

    Added Haskell and Typescript translations, please take a look.

  • nuzyly Avatar

    The second parameter really should be called "predicate", as it represents a boolean function, whereas the term "iterator" describes some kind of cursor that allows its user to traverse a container. There is quite a difference between those two concepts, I would say.

  • donaldsebleung Avatar

    PHP Translation Kumited - please carefully review and approve :D

  • donaldsebleung Avatar

    Javascript version of Kata could have done with a lot more test cases, both fixed and random.

  • JoshSchreuder Avatar

    Hi, I've added a CoffeeScript translation, if you want to approve it, instructions for the approval process are here.

  • danhin Avatar

    I have finished JS in codecademy, but they never explained about reject functions ! What to do now ? I thought this is a platform to learn and if so , how?

  • dreadknight2008 Avatar

    The task for this Kata is unclear. I supposed it needed an array with even numbers filtered out.

  • imago.dei Avatar

    That was a really interesting program. After a few minutes, it actually became very clear what it was asking.

  • garrettguy457 Avatar

    This comment has been hidden.

  • Charliechin Avatar

    This comment has been hidden.

  • ForbesLindesay Avatar

    It needs a test case to reject the people who are accidentally returning the value, rather than true/false

    Test.assertSimilar(reject([true, false], function (x) {
      return !x;
    }), [false]);
    
  • lpommers Avatar

    This one gave me way more trouble that it ought to have.

  • rlabuonora Avatar

    Hello, I'm don't have experience in testing, i'm getting this result from my test and i don't get it:

    Test Failed: Expected: [1,3,5], instead got: [1,3,5]

  • ABNW Avatar

    I don't understand exactly what I am being asked to do here :/?

  • samwellshentin Avatar

    Hi,

    Try adding some more test cases, for example test an array that contains only even numbers: Test.assertSimilar(reject([2, 4, 6, 8, 10, 12], function(num){ return num % 2 == 0; }), []);

    Or only odd numbers: Test.assertSimilar(reject([1, 3, 5, 7, 9, 11], function(num){ return num % 2 == 0; }), [1, 3, 5, 7, 9, 11]);

    The result from those should show you where you're going wrong.

  • user5491118 Avatar

    Hi guys,

    The test will pass with Test Passed: Value == [1,3,5]. When i try to save i get this error message Test Failed: Expected: ["a","b","d"], instead got: ["a","b",3,"d"]

    I have no clue why? Someone can help?