JavaScript中的TypedArray.set()函数
set()TypedArray对象的函数接受一个表示索引的数字数组,并将指定数组的内容从给定索引开始复制到当前数组中。
语法
其语法如下
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
热门推荐
10 乔迁仪式文案祝福语简短
11 分手毕业祝福语简短女生
12 出嫁条幅伴娘祝福语简短
13 20岁简短生日祝福语
14 鲜花卡片简短开业祝福语
15 友谊晚上祝福语大全简短
16 宝宝周岁敬酒祝福语简短
17 公司商务中秋祝福语简短
18 车行销售祝福语简短