Skip to content

Instantly share code, notes, and snippets.

View GheorgheoiuNicolae's full-sized avatar

Nicolae Gheorgheoiu GheorgheoiuNicolae

View GitHub Profile
function flatten(arr) {
var res = [];
for(var i = 0; i < arr.length; i++) {
if(Array.isArray(arr[i])) {
res = res.concat(flatten(arr[i]));
} else {
res.push(arr[i]);
}
}
return res;