【面试题】 let arr = [1, 2]; arr[2] = ‘a‘ arr[‘3‘] = ‘b‘ arr.foo = ‘c‘ arr[‘5‘] = ‘d‘

如下打印结果

let arr = [1, 2];
arr[2] = 'a'
arr['3'] = 'b'
arr.foo = 'c'
arr['5'] = 'd'

console.log(arr);
console.log(arr.length);

【面试题】 let arr = [1, 2]; arr[2] = ‘a‘ arr[‘3‘] = ‘b‘ arr.foo = ‘c‘ arr[‘5‘] = ‘d‘_第1张图片

你可能感兴趣的:(JavaScript,面试题,javascript,前端,ecmascript)