Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const input = gets();
- const types = ['spades','clubs','hearts','diamonds'];
- const N = Number(input) || 10;
- let cards = [];
- for(let i = 2; i <= N; i += 1){
- cards.push(i);
- }
- switch(input){
- case 'A':
- cards.push('J','Q','K','A');
- break;
- case 'K':
- cards.push('J','Q','K');
- break;
- case 'Q':
- cards.push('J','Q');
- break;
- case 'J':
- cards.push('J');
- break;
- }
- const output = []
- for(let i = 0; i < cards.length; i += 1){
- for(let j = 0; j < types.length; j += 1){
- output.push( cards[i] + ' of ' + types[j]);
- }
- print(output.join(', '));
- output.length = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment