TypedArray.set() 函数在 JavaScript 中
TypedArray 对象的 set() 函数接受一个数组和一个表示索引的数字,并将指定数组的内容复制到当前数组中,从给定的索引开始。
语法
其语法如下
typedArray.set()
示例
<html>
<head>
<title>JavaScript Array every Method</title>
</head>
<body>
<script type="text/javascript">
var typedArray1 = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]);
document.write("Contents of the typed array: "+typedArray1);
document.write("<br>");
var typedArray2 = new Int32Array([110, 215, 316, 916, 616, 117, 311 ]);
typedArray1.set(typedArray2, 3);
document.write("Result: "+typedArray1);
</script>
</body>
</html>输出
Contents of the typed array: 11,5,13,4,15,3,17,2,19,8 Result: 11,5,13,110,215,316,916,616,117,311
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP