DEV Community

loading...

Discussion on: What’s your alternative solution? Challenge #51

Collapse
chrismj83 profile image
Chris Johnson • Edited
const findMax = arr => {
    const res = arr.flatMap(val => Array.isArray(val) ? findMax(val) : val).sort((a, b) => a - b);
    return res[res.length - 1];
}