数组 a[100] = 'fox' 后 a.length 是多少?
What will be logged to the console (array length after assigning a[100])?
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: medium
分类: JavaScript Arrays
标签: array length, sparse array
参考答案摘要
数组 length 永远是最大索引 + 1。设置 a[100] 后最大索引变成 100,因此 length 为 101。
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。