Ruby - Arrays
How can you check if the number 10 exists in a flattened version of this array?
arr = [5, [10, 15], [20, [25]]]
arr = [5, [10, 15], [20, [25]]]
arr.flatten to get a single-level array.include?(10) on the flattened array to check presence.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions