SOURCE

// 平衡括号
const test1 = '(){}[]'
const test2 = "{[}](){)"
function demo(val) {
    let value = val.split('')
    let res = null
    
    const open = '({['
    const close = ')}]'
    let openArr = [];
    let closrArr = [];
    value.forEach((e) => {
        if (open.indexOf(e) != -1) openArr.push(e)
        if (close.indexOf(e) != -1) closrArr.push(e)

    })
    console.log(openArr)
    console.log(closrArr)
    return res
}

demo(test2)
console 命令行工具 X clear

                    
>
console