Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.
The map() method of TypedArray instances creates a new typed array populated with the results of calling a provided function on every element in the calling typed array. This method has the same algorithm as Array.prototype.map().
A function to execute for each element in the typed array. Its return value is added as a single element in the new typed array. The function is called with the following arguments:
elementThe current element being processed in the typed array.
indexThe index of the current element being processed in the typed array.
arrayThe typed array map() was called upon.
thisArg OptionalA value to use as this when executing callbackFn. See iterative methods.
A new typed array with each element being the result of the callback function.
See Array.prototype.map() for more details. This method is not generic and can only be called on typed array instances.
The following code takes a typed array and creates a new typed array containing the square roots of the numbers in the first typed array.
The following code shows how map() works when a function requiring one argument is used with it. The argument will automatically be assigned to each element of the typed array as map() loops through the original typed array.
| ECMAScript® 2027 Language Specification # sec-%typedarray%.prototype.map |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.