编辑代码

//JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
// console.log("Hello world!            -  js.jsrun.net ");
function fn(n = [], m = []) {
    const ret = [];
    for(let i = 0, len = n.length; i < len; i++) {
        const map = {};
        for(let w of n[i]) {
            map[w] = true;
        }
        for (let j = 0, l = m.length; j < l; j++) {
            let isValid = true;
            for(let w of m[j]) {
                if (!map[w]) {
                    isValid = false;
                    break;
                }
            }
            if (isValid) ret.push(m[j])
        }
    }
    if (!ret.length) console.log('not found');
    if (ret.length) console.log(ret.join(','));
}

fn(['conection'], ['connection', 'today'])


fn(['bdni', 'wooood'], ['bind', 'wrong', 'wood'])