(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
const arr = [[1,2,[3]],4]; | |
function flattenArray(arr = []) { | |
let flattenedArray = []; | |
arr.forEach(item => { | |
if (Array.isArray(item)) { | |
flattenedArray = [...flattenedArray, ...flattenArray(item)]; | |
} else { | |
flattenedArray.push(item); |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.