Skip to content

Instantly share code, notes, and snippets.

View flatten-array.js
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);
@zoryana94
zoryana94 / introrx.md
Created Feb 26, 2017 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md