Last active
August 2, 2018 21:27
-
-
Save funador/1a2d4a8c933c7e4373cd183cdb65dcec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const dogs = [ | |
| {name: 'Snookums', needsShots: true, breed: 'pug', age: 2}, | |
| {name: 'Thor', needsShots: true, breed: 'hound', age: 1}, | |
| {name: 'Wunderbar', needsShots: false, breed: 'pug', age: 9}, | |
| ] | |
| // We are going to create a new array of our vet approved dogs! | |
| const vetApprovedDogs = dogs.myMap((dog) => { | |
| // The vet makes his approval | |
| dog.needsShots = false | |
| // What ever gets returned ends up at the same index | |
| // in the new array. | |
| return dog | |
| }) | |
| console.log(vetApprovedDogs) // everyone has their shots! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment