Lesson

Counting Cards, freeCodeCamp Basic Javascript

Lesson Summary

In this basic Javascript freeCodeCamp challenge we create a card counting function in javascript. A card counting function can be used in games like blackjack to help guess what card may or may not be coming next. A javascript card counting function can be written using switch statements that decrements, increments, or doesn't change when our function is called and updates our global count variable each time we count a card. We learn that by keeping track of how many high cards or low cards are left in the game, we can better guess when to bet or when to hold off.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required


Share: