Im having trouble with a card game. I need to print the deck than take a card and remove it from the deck. What is my mistake? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Im having trouble with a card game. I need to print the deck than take a card and remove it from the deck. What is my mistake?

Whenever I run the code is says exceptionoutofbound for the array but im using "length" to adjust every time it takes a card out. Need help in understanding my mistake. https://code.sololearn.com/c0BFYyTz854X/?ref=app

12th Sep 2018, 2:33 AM
Jossue
Jossue - avatar
1 Answer
+ 2
Line 42 your using DECK[DECK.length], which doesn't exist as indexes are 0 to DECK.length-1.
12th Sep 2018, 3:47 AM
John Wells
John Wells - avatar