Home » JavaScript TypedArray map() Method

JavaScript TypedArray map() Method

by Online Tutorials Library

JavaScript TypedArray map() Method

The JavaScript map() method form a new array creates a new typed array with the results of calling a provided function on every element in this typed array.

NOTE: map() method does not change the actual array.

Syntax:

Parameters:

Value(Required): The value of the current element.

Index(Optional): The array index of the current element.

arr(Optional): The array map() was called upon.

ThisValue(Optional): A value to be passed to the function to be used as its “this” value.

Return value:

A new array.

Browser Support:

Chrome Yes
Safari Yes
Firefox 1.5
Opera Yes

Example 1

JavaScript map() Method

Test it Now

Output:

2,4,6  

Example 2

JavaScript map() Method

Test it Now

Output:

10,1,3,5  

You may also like