TypedArray 객체의 forEach() 함수는 함수의 이름을 나타내는 문자열 값을 받아 배열의 모든 요소별로 실행합니다.
구문
구문은 다음과 같습니다.
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