alboig

PrintDeckOfCards

Apr 3rd, 2020
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //respect, Niki!!!
  2. const input = ['Q'];
  3. const gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  4. const print = this.print || console.log;
  5. const deckOfCards = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'];
  6. const card = gets();
  7. let index = 0;
  8. do {
  9.   const face = deckOfCards[index];
  10.   print(`${face} of spades, ${face} of clubs, ${face} of hearts, ${face} of diamonds`);
  11. } while (deckOfCards[index++] !== card);
Advertisement
Add Comment
Please, Sign In to add comment