Skip to content

Instantly share code, notes, and snippets.

Carlos Rene Cerrato Estrada ccerrato147

Block or report user

Report or block ccerrato147

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View flatArray.js
// The nested array
const nested = [[1,2,[3,[8,10]]],4];
// An array that will contain the flatten array
const flat = [];
// The function that runs through the array and flattens it
const scan = (el, arr) =>{
if(!Array.isArray(el))
throw "The first parameter should be an array";
if(!Array.isArray(arr))
throw "The second parameter should be an array";
You can’t perform that action at this time.