Return Only the Int

Published by bangyen in

Write a function that takes an array of elements and returns only the ints.

Examples

returnInts([9, 2, "space", "car", "lion", 16]) ➞ [9, 2, 16]

returnInts(["hello", 81, "basketball", 123, "fox"]) ➞ [81, 123]

returnInts([10, "121", 56, 20, "car", 3, "lion"]) ➞ [10, 56, 20, 3]

returnInts(["String",  true,  3.3,  1]) ➞ [1]

Notes

N/A

Watch a quick demo on how Edabit works.