Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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']
Add Comment
Please, Sign In to add comment