Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

JavaScript is the familiar name for a language standardized as ECMAScript. The ECMA-262 specification defines the language’s syntax and behavior, including built-in objects such as arrays; it does not define every capability available in a browser or other host. The method Array.prototype.map shows how that standard turns a simple coding operation into precise rules about callback arguments, missing elements, and changes made during iteration.

What is ECMAScript?

ECMAScript is the standardized language definition, and ECMA-262 is the specification that sets out that definition. Ecma International’s living ECMAScript 2027 Language Specification states, “This Standard defines the ECMAScript 2027 general-purpose programming language.” Its subject includes syntax and semantics, built-in types and values, objects, properties, and functions.

The living document accessed for this article identifies itself as the eighteenth edition and has a draft heading dated October 1, 2026. It describes the 2027 edition as containing the latest yearly snapshot along with finished proposals that have reached Stage 4. Because the specification is a living document, its contents and edition label can change; the edition and date identify the version described here.

Is JavaScript the same as ECMAScript?

In everyday programming, JavaScript is the name people use for the language. In the specification’s framing, JavaScript is among the technologies from which ECMAScript originated; ECMAScript is the standardized definition. The names are closely connected, but the distinction matters when asking exactly what a standards document guarantees.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

ECMA-262 defines a core language intended to be used within a host environment. A host supplies environment-specific facilities beyond that core. For example, browser APIs belong to the browser environment, not to the ECMAScript language definition itself. A feature being available to JavaScript code therefore does not, by itself, mean ECMA-262 specifies it.

How does the specification define Array.prototype.map?

In section 23.1.3.21 of the ECMAScript indexed collections chapter, map is defined as an operation that calls a supplied callback for eligible array elements and constructs a new Array from the callback results. The callback receives three arguments: the element value, its index, and the object being traversed. Calls happen in ascending index order, and the method accepts an optional thisArg for the callback.

Missing elements are skipped

A sparse array can have indices with no element. For those missing positions, map does not call the callback. The resulting array retains corresponding holes rather than receiving callback results for them.

The iteration range is set at the start

The range of indices to process is determined before the first callback runs. If a callback appends elements beyond that initial range, those new elements are not visited. For an index within the range, the method reads the element when it reaches that index: a changed value is therefore observed, while an element deleted before its turn is skipped.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A new result does not make callback code side-effect-free

map constructs a new array and does not itself directly mutate the array it is called on. That is not a guarantee that the whole operation has no side effects: callback code can change the original array or other state. The specification’s rules about the initial index range and visit-time reads describe what happens if such changes occur.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When is map the right array method?

Use map when the purpose is to transform values and collect the callback’s results into a new array. A method such as forEach is used for callback effects rather than to construct a mapped result. This is a difference in purpose and return behavior, not a claim about relative performance.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.