Skip to content

Instantly share code, notes, and snippets.

Eliecer Chicott EliecerC

Block or report user

Report or block EliecerC

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
@EliecerC
EliecerC / flatten.js
Created Dec 19, 2018
Array Flatten JavaScript
View flatten.js
'use strict';
Array.prototype.flatten = function(array) {
var flattened = [];
var getItemValue = function(item) {
Array.isArray(item)
? item.map(getItemValue)
: flattened.push(item);
};
this.map(getItemValue);
You can’t perform that action at this time.