SOURCE

function flat(list) {
    const result = [];

    list.forEach(item => {
        if (Array.isArray(item)) {
            result.push(...flat(item));
        }
        else {
            result.push(item);
        }
    })

    return result;
}

const list = [3, [5, 2], [1, 1, [7],5]];

// 方案一:
console.log(list.toString().split(',').map(item => +item));
// 方案二:
console.log(flat(list));
console 命令行工具 X clear

                    
>
console