byteLength的SharedArrayBuffer的属性返回一个无符号的32位整数,指定一个SharedArrayBuffer的大小/长度。
其语法如下
sharedArrayBuffer.byteLength
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var sharedArrayBuffer = new SharedArrayBuffer(8);
var result = sharedArrayBuffer.byteLength;
document.write("length of the shared array buffer is: " + result);
</script>
</body>
</html>输出结果
length of the shared array buffer is: 8