In Java Script how do you code an array with the values and suits of cards...

80.2K

Verified Solution

Question

Programming

In Java Script how do you code an array with the values andsuits of cards (all 52 cards in a deck) 2 different array one thatjust has the face values of the card, and the other with the suitvalue. Then have it randomly give you 1-2 cards from the deckwithout repeating? (Example: Dealer gives player two cards. Playerasks for a hit and the dealer gives a different card, no repeats).Game is Blackjack.

Answer & Explanation Solved by verified expert
4.1 Ratings (715 Votes)
var suits Diamonds Hearts Clubs Spades var ranks A 2 3 4 5 6 7 8 9 10 J Q K var deck new Array var hand new Array var score 0 function initCardrank suit Function to create and return a card using the provided rank and suit if ranksrank J ranksrank Q ranksrank K value 10 In blackjack Face cards has value 10 else if ranksrank A value 11 In blackjack    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students