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 订婚领证祝福语简短精辟
14 导师获奖祝福语大全简短
15 新婚购房祝福语简短精辟
16 牛年祝福语简短的爱人
17 送芒果的祝福语简短
18 送给学长毕业祝福语简短