JavaScript中的TypedArray.forEach()函数
forEach()TypedArray对象的函数接受表示函数名称的字符串值,并针对数组中的每个元素执行该函数。
语法
它的语法如下
typedArray.forEach()
示例
<html>
<head>
<title>JavaScript Array every Method</title>
</head>
<body>
<script type="text/javascript">
var int32View = new Int32Array([21, 19, 65,21, 14, 66, 87, 55 ]);
document.write("Contents of the typed array: "+int32View);
document.write("<br>");
document.write("Result: ");
function testResult(element, index, array) {
document.writeln(element+100);
}
int32View.forEach(testResult);
//document.write("Result: "+result);
</script>
</body>
</html>输出结果
Contents of the typed array: 21,19,65,21,14,66,87,55 Result: 121 119 165 121 114 166 187 155
热门推荐
10 新年门口花束祝福语简短
11 盘锦结婚祝福语大全简短
12 父母生日祝福语 简短独特
13 家庭恩爱祝福语简短英文
14 高考俄语祝福语大全简短
15 虎年祝福语 诗句唯美简短
16 生日婚礼祝福语简短精辟
17 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短