why is solutaion is not correct #3164
Replies: 1 comment
-
Github discussions are meant to discuss issues and ideas related to Codewars platform and website. Discussions are not meant for help with individual kata. Please ask your question in the discourse of the kata you are trying to solve, or in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
n this kata you will create a function that takes a list of non-negative integers and strings and returns a new list with the strings filtered out.
Example
filter_list([1,2,'a','b']) == [1,2]
filter_list([1,'a','b',0,15]) == [1,0,15]
filter_list([1,2,'aasf','1','123',123]) == [1,2,123]
my solutaion :
function filter_list(l) {
return l.map(item => typeof item === 'number' ? item : null).filter(Boolean);
}
output:
For input [1,"a","b",0,15]: expected [ 1, 15 ] to deeply equal [ 1, +0, 15 ]
Beta Was this translation helpful? Give feedback.
All reactions