Created
October 22, 2019 23:30
-
-
Save josecarneiro/67010496fd736dbe67bedfd173d8b043 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
// ITERATION 1 | |
// Suspects Collection | |
const suspectsArray = []; | |
// Rooms Collection | |
const roomsArray = []; | |
// Weapons Collection | |
const weaponsArray = []; | |
// ITERATION 2 | |
const selectRandom = array => array[Math.floor(Math.random() * array.length)]; | |
const pickMystery = () => { | |
const weapon = selectRandom(weaponsArray); | |
const suspect = selectRandom(suspectsArray); | |
const room = selectRandom(roomsArray); | |
return { weapon, suspect, room }; | |
}; | |
// ITERATION 3 | |
const revealMystery = mystery => | |
`${mystery.suspect.firstName} ${mystery.suspect.lastName} killed Mr. Boddy using the ${mystery.weapon.name} in the ${mystery.room.name}!`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment