7 kyu
JavaScript Array Filter
18,893 of 28,364jhoffner
Loading description...
Arrays
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
this kata should be 8 kyu
8 kyu
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/139.
Please join the discussion to help us identify duplicate kata and retire them.
Haskell translation
Approved
COBOL translation.
Approved
C Translation kumited, (author probably busy).
Thanks :)
Thank you for that kata. I rarely use that func, but I know it is useful for coding. Starting training:)
TypeScript translation
Approved
Nice
This comment has been hidden.
This comment has been hidden.
( JS, probably others )
This is not tested.
Python 3.6 tests have a module import error. Python 3.8 still works properly.
Fixed.
C++ translation kumited
Approved some time ago
Coffeescript
Crystal
Julia
R
(author inactive)
Thanks :)
Ruby translation kumited :) please check and approve ~~
Created a Python translation for this kata, with random tests and sample tests. Also created a Python-specific description for the kata. Here's the link: https://www.codewars.com/kumite/5cdc7b84accbd30018458874?sel=5cdc7b84accbd30018458874
Feel free to provide feedback, anything constructive is more than welcome. If it's good enough, I would also highly appreciate an approval (:
JS :
Added sample tests in my Python translation, if anyone with the honor required to edit katas wants to include them in the format in the JS version, feel free.
Added.
I think you should add more description for the kata. At least say something like "return an array with only even numbers" or something along those lines.
Thank you because as it stands I did not understand what was being asked.
Hi, I've added a CoffeeScript translation, if you want to approve it, instructions for the approval process are here.
I don't know if this is happening only with me, but I submitted at least 3 different functions to test and all of them returned "Test didn't pass: Unknown error", considering that I tested them at the console and they gave me the right results this "error" is a bit odd. But when I hit submit it passes without any error.
This comment has been hidden.
There is the same kata on 7 kyu calles "No oddities here"
Hello! I just did this test, I have no idea how these test things work really, but i wrote:
Test.assertEquals([2,4,6],[2,4,6]) and got the error: "Test Failed: Expected: [2,4,6], instead got: [2,4,6]"
I did this test to just test it out how it worked. I assume that in this: "Test.assertEquals(actual, expected, [optional] message)" the actual is the part you send into the function and expected is the thing that is expected so.
So error in test?
Edit: I completed this with my solution but test case still dosent work.
This is broken, I have written 3 functions that all return only even numbers, excludes 0, includes 0; and despite the fact I 100% know I have a solution it says array has too many values... so, fyi.
I've updated the tests to use the newer spec format, which should make it easier to debug. However the tests were not incorrect. As of now 3,649 people have solved this kata. Let me know if you are still having issues.
i'm getting this error: "Failed to construct test fixture properly" in the output tab.
This is a bit odd to me, When I ran tests I get the Error "Could not load test cases" so I uncomment the Tests and rerun and get "Unexpected Identifier" When I hit submit it passes even though it shows errors?
[deleted]
0 is neither odd nor even, so [0] should return [] -- no?
0 is even (http://en.wikipedia.org/wiki/Parity_of_zero)
one of those days (mixed up positive/negative) :]
Yeah, I keep getting this when I execute my own test:
Test Failed: Expected: [2,4,6], instead got: [2,4,6]
and this is not exactly rocket surgery. What's going on?
use assertSimilar instead of assertEquals
I keep getting "Test Failed: function returned an array with too many values" despite checking that there are X even numbers and it is returning X sized array with just even numbers.
Maybe you should give at hint for the tests not to use assertEquals but assertSimilar instead. Otherwise you'll get errors.
Shouldn't it say JavaScript Arrays support, not JavaScript Array's support?
I would add the following tests: Test.expect(numbers.indexOf(1) == -1) Test.expect(numbers.indexOf(3) == -1)
It's highly unlikely, but somebody could write a function that removes the 2 and the 6, and the current tests would pass.
Thanks. I added some additional test cases to make it more robust.