Created
March 10, 2016 21:13
-
-
Save CharlesAMoss/ba3dcfea3cd2ea397c44 to your computer and use it in GitHub Desktop.
This file contains 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
'use strict'; | |
let getDeck = () => { | |
let deck = []; | |
const numVal = _.range(2, 11).map(String); | |
const faceVal = ['J', 'Q', 'K', 'A']; | |
const value = numVal.concat(faceVal); | |
const suits = ['♠', '♥', '♣', '♦']; | |
for (var suit of suits) { | |
const cards = value.map(val => val + suit); | |
deck.push(cards); | |
} | |
deck = _.flatten(deck); | |
return deck; | |
}; | |
console.log(getDeck()); | |
// ["2♠","3♠","4♠","5♠","6♠","7♠","8♠","9♠","10♠","J♠","Q♠","K♠","A♠", | |
// "2♥","3♥","4♥","5♥","6♥","7♥","8♥","9♥","10♥","J♥","Q♥","K♥","A♥", | |
// "2♣","3♣","4♣","5♣","6♣","7♣","8♣","9♣","10♣","J♣","Q♣","K♣","A♣", | |
// "2♦","3♦","4♦","5♦","6♦","7♦","8♦","9♦","10♦","J♦","Q♦","K♦","A♦"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment