array-map-x
Creates an array with the results of calling a function on every element.
Version: 2.3.0
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750
module.exports
⇒ array
⏏
This method creates a new array with the results of calling a provided
function on every element in the calling array.
Kind: Exported member
Returns: array
- A new array with each element being the result of the
callback function.
Throws:
TypeError
If array is null or undefined.TypeError
If callBack is not a function.
Param | Type | Description |
---|
array | array | The array to iterate over. |
callBack | function | Function that produces an element of the Array. |
[thisArg] | * | Value to use as this when executing callback. |
Example
var map = require('array-map-x');
var numbers = [1, 4, 9];
var roots = map(numbers, Math.sqrt);