JavaScript 中的 TypedArray.subarray() 函数
TypedArray 对象的 subarray() 函数返回当前数组的一部分。该函数接收两个数字,表示子数组的开始和结束。
用法
语法如下
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
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP