Created
November 10, 2019 15:36
-
-
Save ramazankanbur/d880b6139f68aeb8bb8683ab7ee9445b 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
| var primaryColors = [ | |
| {color: 'red'}, | |
| {color: 'yellow'}, | |
| {color: 'blue'} | |
| ]; | |
| var result = primaryColors.reduce(function(previous, primaryColor) { | |
| previous.push(primaryColor.color); | |
| return previous; | |
| }, []); | |
| console.log(result); | |
| //output | |
| ["red", "yellow", "blue"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment