JavaScript中的TypedArray.values()函数
values()TypedArray的函数返回一个迭代器对象,该对象保存类型化数组的值。该next()方法返回迭代器对象中的下一个元素。
语法
其语法如下
typedArray.values()
示例
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var typedArray = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]);
var iterator = typedArray.values();
document.write("Contents of the typed array: ");
for(i=0; i<typedArray.length; i++) {
document.writeln(iterator.next().value);
}
</script>
</body>
</html>输出结果
Contents of the typed array: 11 5 13 4 15 3 17 2 19 8
热门推荐
10 小红书平安祝福语简短
11 生日祝福语大全女孩简短
12 收生日红包祝福语 简短
13 领证幽默祝福语简短
14 法考面试祝福语简短
15 老哥出门祝福语简短语
16 送灯祝福语简短独特
17 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语