Add variable declaration (#34702)
* Declare variable * Update guide/english/certifications/javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array/index.md Co-Authored-By: ojeytonwilliams <ojeytonwilliams@gmail.com>
This commit is contained in:
committed by
Randell Dawson
parent
7cda5ce59c
commit
36bad642c2
@ -14,7 +14,7 @@ array.prototype.map takes a function as in input and returns an array. The retur
|
|||||||
|
|
||||||
##  Intermediate Code Solution:
|
##  Intermediate Code Solution:
|
||||||
```javascript
|
```javascript
|
||||||
rating = watchList.map( (item) => ({"title":item["Title"], "rating":item["imdbRating"]}) );
|
const rating = watchList.map(item => ({title: item["Title"], rating: item["imdbRating"]}));
|
||||||
```
|
```
|
||||||
### Code Explanation:
|
### Code Explanation:
|
||||||
Using ES6 notation, each item in array is processed to extract title and rating.
|
Using ES6 notation, each item in array is processed to extract title and rating.
|
||||||
|
Reference in New Issue
Block a user