面试题

    const obj = {a:1,b:2,c:3};
    function foo(o,arr){
        //实现该方法
    }
    foo(obj,["a","c"]); //{a:1,c:3}
    function foo(o,arr){
        let tmp = {};
        arr.forEach(i => (o[i] !== undefined) && (tmp[i] = o[i]));
        return tmp
    }