下面代码的输出是: function func(source) {&nb...
发布于 2022-03-02 16:49:58
下面代码的输出是:
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)
登录后免费查看答案
关注者
0
被浏览
22