HA
flatten([1, 'string', null, function() {}, [5, 3, [36, 45], 12], [], { name: john }]);
function flatten(list) {
list.map((item, index) => {
if(Array.isArray(item)){
list.push.apply(list, item)
list.splice(index, 1);
flatten(list);
}
});
return list;
}