Guest User

Untitled

a guest
Jul 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. const colors1 = ['#111', '#222', '#333'];
  2. const colors2 = ['#444', '#555', '#666'];
  3.  
  4. const colorChoice = (colors) => {
  5. return colors[Math.floor(Math.random() * colors.length)];
  6. };
  7.  
  8. colorChoice(colors1);
  9. // Returns one of: ['#111', '#222', '#333']
  10.  
  11. colorChoice(colors2);
  12. // Returns one of: ['#444', '#555', '#666']
Add Comment
Please, Sign In to add comment