JavaScript 中的 TypedArray.values() 函数
htmljavascriptprogramming scripts更新于 2024/10/22 3:56:17
TypedArray 的 values() 函数返回一个迭代器对象,该对象保存类型数组的值。next() 方法返回迭代器对象中的下一个元素。
语法
其语法如下
typedArray.values()
示例
<html>
<head>
<title>JavaScript 示例</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
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

