- Trending Categories
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.map() function in JavaScript
The map() function of the TypedArray object accepts the name of a function and calls it on every element of the typed array and returns the results.
Syntax
Its Syntax is as follows
typedArray.map()
Example
<html> <head> <title>JavaScript Array every Method</title> </head> <body> <script type="text/javascript"> var int32View = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]); document.write("Contents of the typed array: "+int32View); document.write("<br>"); function square(ele) { return ele*ele; } var result = int32View.map(square); document.write("Specified element occurred at the index: "+result); </script> </body> </html>
Output
Contents of the typed array: 11,5,13,4,15,3,17,2,19,8 Specified element occurred at the index: 121,25,169,16,225,9,289,4,361,64
Advertisements