web-interview
web-interview copied to clipboard
[选择题] 42.(单选题)下面代码的输出是什么
function getAge(...args) {
console.log(typeof args);
}
getAge(21);
A:"number"
B: "array"
C: "object"
D: "NaN"
答案:C
解析:
扩展运算符(...args )返回一个带参数的数组。 数组是一个对象,因此typeof args返回object。