Filter Strings from Array

Published by bangyen in

Create a function that takes an array of strings and integers, and filters out the array so that it returns an array of integers only.

Examples

filter_array([1, 2, 3, "a", "b", 4]) ➞ [1, 2, 3, 4]

filter_array(["A", 0, "Edabit", 1729, "Ruby", "1729"]) ➞ [0, 1729]

filter_array(["Nothing", "here"]) ➞ []

Notes

Don't overthink this one.

Watch a quick demo on how Edabit works.