Skip to content

Instantly share code, notes, and snippets.

Dragan Smiljanic draganSm

View GitHub Profile
View flatten.js
/**
* Flattens the giving array recursively
* @param array
* @returns {Array}
*/
export default function flattenArray(array, result = []) {
for (const element of array) {
if (Array.isArray(element)) {
flattenArray(element, result);
}
You can’t perform that action at this time.