Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
this contain bool and object and an array not only number
I agree! It's the one that actually does what's asked instead of filtering out everything that's not a number.
I agree mostly, but the instructions do say that the incoming data is lists of non-nengative integers and strings. So the arrays have two types of data. So either way accomplishes the goal. However I do prefer to filter our strings for the reason mentioned that in the future should more data types be added then this function still does it's task without changes. Since the task was to remove strings and not return numbers. The top rated one would require rework to function correctly if other data types were added in the future, so I fail to see why it's "best practice"
I definitely agree, since the instructions say "with the strings filtered out", not "with only the integers returned". The other solutions seem to just be passing the test cases, as opposed to fully following the instructions. Perhaps a random test with different data-types could be added?
I like this approach in part because it filters out strings rather than returning numbers.
This code can be used on arrays that contain more data types than just Strings and Numbers,
and will return the array less the Strings.