SOURCE

const str1 = 'asdqwdad1'
const str2 = 'asd22332'
const str3 = 'asdcccc'

const fn1 = (str1, str2) => {
    let res = ''
    for(let i = 0; i < str1.length; i++){
        for(let j = i; j < str1.length; j++){
            let str = str1.substring(i, j + 1)
            if(str2.indexOf(str) !== -1 && str.length > res.length){
                res = str
            }
        }
    }
    return res
}

const fn2 = (...args) => {
    return args.reduce((acc, curr) => {
        acc = fn1(acc, curr)
        return acc
    })
}

console.log(fn2(str1, str2, str3))
console 命令行工具 X clear

                    
>
console