Added definitions to parameters (#22818)

* Added definitions to parameters

* Add formatting
This commit is contained in:
Pixelposh
2018-11-22 18:04:20 +01:00
committed by Huyen Nguyen
parent 8d593a1256
commit a9f4f11a77

View File

@ -12,6 +12,11 @@ The original syntax of the map function is:
// Do some stuff with currentValue (index and array are optionals) // Do some stuff with currentValue (index and array are optionals)
}) })
``` ```
* `new_arr` - the new array that is returned
* `ar`r - the array to run the map function on
* `currentValue` - the current value being processed
* `index` - the current index of the value being processed
* `array` - the original array
### Example (ES6): ### Example (ES6):
@ -21,4 +26,4 @@ const myArray_2 = myArray_1.map(el => el * 2);
``` ```
`myArray_2` will contain the elements: `[2, 4, 6, 8]` `myArray_2` will contain the elements: `[2, 4, 6, 8]`
`map()` is a method of the `Array` object, so to pass that function to an iterable object it is necessary to make the object an Array. `map()` is a method of the `Array` object, so to pass that function to an iterable object it is necessary to make the object an Array.