Edit in JSFiddle

var array = [0, 1, [2, 3, [4, 5, [6, 7, [8, 9], 10, 11], 12, 13], 14, 15], 16, 17];

// the lodash way 
var cool = _.flattenDeep(array);

// Pure JS
function flattenDeep(ary) {
    var ret = [];
    for(var i = 0; i < ary.length; i++) {
        if(Array.isArray(ary[i])) {
            ret = ret.concat(flattenDeep(ary[i]));
        } else {
            ret.push(ary[i]);
        }
    }
    return ret;
}
notCool = flattenDeep(array);

//display it on page
document.getElementById("cool").innerHTML = JSON.stringify(cool);
document.getElementById("not-cool").innerHTML = JSON.stringify(notCool);
Lodash result:
<p id="cool"></p>
Pure JS result:
<p id="not-cool"></p>
body {
    font-family: sans-serif;
}
p {
    border-bottom: 1px solid black;
    padding: 15px;
}

#cool {
    background: rgba(0, 255, 0, 0.2);
}

#not-cool {
    background: rgba(255, 0, 0, 0.2);
}
}

External resources loaded into this fiddle: