Sobes.tech
Junior — Senior

Converting a nested array to a uniform form

livecode

Task condition

Given an array that may contain elements of different types and an arbitrary number of nested arrays. It is necessary to write a function that recursively unfolds all nested arrays and forms a new array where each element is on a single level.


const arr = [1, 2, '3', null, 4, '5', 'test', 5, [null, null, 5]];