Skip to content

Commit ca765cc

Browse files
authored
Create List Filtering
1 parent fd8cf2b commit ca765cc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

List Filtering

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
7 kyu
2+
List Filtering
3+
4+
In 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.
5+
6+
Example
7+
filter_list([1,2,'a','b']) == [1,2]
8+
filter_list([1,'a','b',0,15]) == [1,0,15]
9+
filter_list([1,2,'aasf','1','123',123]) == [1,2,123]
10+
11+
12+
const filter_list = list => list.filter(num => typeof num === 'number')
13+
14+
15+
console.log(filter_list([1,2,'a','b']),[1,2])

0 commit comments

Comments
 (0)