为什么Float32Array.length的值总是3
Why is the value of Float32Array.length always 3?
当我遇到时,我正在阅读Float32Arrays上的Mozilla开发者网络文档
Float32Array.length
Length property whose value is 3.
为什么总是3?我还注意到,同名的prototype属性覆盖了它。
Float32Array
实际上是一个函数。你可以像这个一样检查
console.assert(typeof Float32Array === 'function');
这个函数接受三个参数。引用同一文件的签名,
Float32Array(buffer [, byteOffset [, length]]);
引用Function.length
文件,
length
是函数对象的一个属性,表示函数需要多少个参数,即形式参数的数量。
这就是为什么CCD_ 5的CCD_。
这是因为构造函数最多需要3个参数:
Float32Array(buffer [, byteOffset [, length]]);
JavaScript中的每个函数都有一个length属性,该属性将返回它所使用的命名参数的计数。
例如
function foo(a, b) {}
foo.length === 2; // true
function bar() {}
bar.length === 0; // true
这是(object-)函数Float32Array
的参数数的长度。
然而,当您实例化它时,length
将表示索引的数量:
console.log(Float32Array.length); // => 3, number of arguments
var a = new Float32Array(10); // create an instance with 10 indexes
console.log(a.length); // => 10, number of indexes
相关文章:
- TypeError:在不兼容的接收器nodejs上调用了方法Uint8Array.length
- Array.length似乎不起作用;console.log则显示其他情况
- 为什么Float32Array.length的值总是3
- jQuery.length()速度含义
- JQuery `length`属性工作不正常.为什么?
- 可以't将.length属性与IronJS和ArrayObject一起使用
- 如何有效地将Float32Array插入Float32Array
- javascript testing .length and .length > 0
- getElementsByTagName('img').length logs out to 0
- 为什么 .length 在此代码中总是返回 0
- jquery .length 不返回实际长度
- 有时 array.length 只在 .push() 之后工作(为什么?)
- 当Json Length过长时,对ASP.NET MVC Controller的Ajax调用返回404
- 是什么导致JS中出现这种带有.length的奇怪行为
- 在for循环中使用x.length时出现问题
- Javascript document.images.length returning 0
- 流星+聚合物-核心子菜单投掷'undefined不是对象(正在评估'this.items.length&
- 文本框's的length属性在JQuery中从不返回0
- Function.length和this.length不一样.为什么
- .length不处理$resource导致angularjs