instance method Array#map

View source on GitHub →

Array#map([iterator = Prototype.K[, context]]) → Array
  • iterator (Function) – The iterator function to apply to each element in the enumeration.
  • context (Object) – An optional object to use as this within calls to the iterator.

Returns the result of applying iterator to each item in the array. If no iterator is provided, the elements are simply copied to the returned array.

Array#map acts as an ECMAScript 5 polyfill. It is only defined if not already present in the user's browser, and it is meant to behave like the native version as much as possible. Consult the ES5 specification for more information.