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
// Prompt: take an array called "cards" that is a hand in a card game populated with card Objects and return an Object that sorts the cards according to suit (i.e. the key will be the suit name and the value will be an array of face values of that suit) | |
/* | |
- On line 20, you can see I'm setting the default value of the accumulator to an empty Object {} and naming the argument "suits" for clarity | |
- This is because the default value of the accumulator is 0, but since I want the reducer to return an Object, you indicate that here to override the default behavior. | |
- The conditional on line 17 checks if the current suit already exists in the suits Object, and if not, creates an empty array to receive it | |
*/ | |
const card1 = { value: "9", suit: "hearts" } | |
const card2 = { value: "K", suit: "hearts" } |
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
################################################################## | |
# # | |
# README: # | |
# # | |
# This assumes that you have not yet created the app on Heroku, # | |
# your publish-ready project is git initialized and committed, # | |
# and you are in the base directory of the project. # | |
# # | |
################################################################## |