题库 软件开发 题目列表 下面代码的输出是: function func(source) {  v...
单选题
下面代码的输出是:
function func(source) { 
    var target = {}; 
    for (var key in source) { 
        if (Object.prototype.hasOwnProperty.call(source, key)) {
             if (typeof source[key] === 'object') { 
                target[key] = func(source[key]); 
             } else { 
                target[key] = source[key]; 
             }
        } 
    } 
    return target; 
}
var a = { a1: "a1", a2: { b1: "b1", b2: "b2" }, a3: undefined, a4: null, a5: 1 };
var b = func(a); 
console.log(b);

A.

{a1: "a1", a2: {b1: "b1", b2: "b2"}, a3: undefined, a4: {}, a5: 1}

B.

{a1: "a1", a2: {b1: "b1", b2: "b2"}, a3: null, a4: null, a5: 1}

C.

{a1: "a1", a2: {b1: "b1", b2: "b2"}, a3: undefined, a4: undefined, a5: 1}

D.

{a1: "a1", a2: {b1: "b1", b2: "b2"}, a3: undefined, a4: null, a5: 1}

题目信息
校招真题
-
正确率
0
评论
17
点击