Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const nestedArraysToFlat = (nestedArrays, flatArray = []) => {
- nestedArrays.forEach(item => {
- return item instanceof Array ? nestedArraysToFlat(item, flatArray) : flatArray.push(item)
- })
- return flatArray
- }
- export default nestedArraysToFlat
Add Comment
Please, Sign In to add comment