- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
TypedArray.forEach() function in JavaScript
The forEach() function of TypedArray object accepts a string value representing the name of a function and executes it per every element in the array.
Syntax
Its Syntax is as follows
typedArray.forEach()
Example
<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>
Output
Contents of the typed array: 21,19,65,21,14,66,87,55 Result: 121 119 165 121 114 166 187 155
Advertisements