subarray()TypedArray对象的函数返回当前数组的一部分。它接受两个数字,分别代表子数组的开始和结束。
其语法如下
typedArray.subarray(5, 9)
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var typedArray = new Int32Array([111, 56, 62, 40, 75, 36, 617, 2, 139, 827 ]);
var result = typedArray.subarray(3, 7);
document.write("Contents of the typed array: "+result);
</script>
</body>
</html>输出结果
Contents of the typed array: 40,75,36,617