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

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

Open qiilee opened this issue 5 years ago • 0 comments

let newList = [1, 2, 3].push(4);

console.log(newList.push(5));
A:[1,2,3,4,5]
B: [1,2,3,5]
C: [1,2,3,4]
D: Error

答案:D

解析:

.push()方法返回数组的长度,而不是数组的本身。

qiilee avatar Apr 15 '20 02:04 qiilee