有人可以解释一下为什么alert.length返回“ 0”,为什么Array.length或Object.length返回1

问题描述 投票:0回答:1

有人可以向我解释为什么alert.length返回“ 0”,为什么Array.lengthObject.length返回“ 1”

console.log('alert.length: '  + alert.length);  // 0
console.log('Array.length: '  + Array.length);  // 1
console.log('Object.length '  + Object.length); // 1
console.log('String.length: ' + String.length); // 1

/* as you see can anyone of you explain me why this works this way */

有人可以向我解释一下。 ECMAScript specification]中提到了此行为吗?

有人可以向我解释为什么alert.length返回“ 0”以及Array.length或Object.length为什么返回“ 1” console.log('alert.length:'+ alert.length); // 0 console.log('Array.length:'+ ...

javascript language-lawyer alert
1个回答
1
投票

length属性指示函数期望的参数数量。

© www.soinside.com 2019 - 2024. All rights reserved.