JavaScript中的TypedArray.byteLength属性
TypedArray对象的byteLength属性表示其(以字节为单位)TypedArray的长度。
语法
其语法如下
typedArray.byteLength();
示例
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var buffer = new ArrayBuffer(156);
var float32 = new Float32Array(buffer);
document.write(float32.byteLength);
</script>
</body>
</html>输出结果
156