web-interview icon indicating copy to clipboard operation
web-interview copied to clipboard

[选择题] 42.(单选题)下面代码的输出是什么

Open qiilee opened this issue 5 years ago • 0 comments

function getAge(...args) { 
  console.log(typeof args);
}
getAge(21);
A:"number"
B: "array"
C: "object"
D: "NaN"

答案:C

解析:

扩展运算符(...args )返回一个带参数的数组。 数组是一个对象,因此typeof args返回object。

qiilee avatar Apr 15 '20 02:04 qiilee