yisainan / web-interview

我是齐丶先丶森,收集整理全网面试题及面试技巧,旨在帮助前端工程师们找到一份好工作!更多详见公众号「前端面试秘籍」

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

qiilee opened this issue · 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()方法返回数组的长度,而不是数组的本身。