Created
July 20, 2018 17:39
-
-
Save pbzona/feb44019217e6d819655aab49fa9fc80 to your computer and use it in GitHub Desktop.
color randomizer
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 colors1 = ['#111', '#222', '#333']; | |
const colors2 = ['#444', '#555', '#666']; | |
const colorChoice = (colors) => { | |
return colors[Math.floor(Math.random() * colors.length)]; | |
}; | |
colorChoice(colors1); | |
// Returns one of: ['#111', '#222', '#333'] | |
colorChoice(colors2); | |
// Returns one of: ['#444', '#555', '#666'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment