Day 2 of 30 - Building A Blackjack Game (Part - 2)

Leader ●2 ●9 ●27
calendar_today ago • schedule1 min read

I ended yesterday's session with adding a New Card button to the game to allow players draw a new card from the deck.

In today's coding session. I made the New Card button functional.

How it works:

  • The New card button triggers a newCard() function.
  • The function creates a new card with a number variable (hard coded for now)
  • The newly created card number is added to the existing Sum (of cards);
  • The newly created card number is also added to the array of cards, so it can be displayed on the ui.
  • The function calls the renderCard() function which iterates through the card array and displays the card numbers in it on the ui, then checks the conditions and displays the players status.

What I learned:

Working on this feature helped me brush up on my Arrays and for loop skills. I learned:

  • Arrays
  • Array properties and methods
  • For loop
  • Using forloop with arrays.

Even though it felt like I already knew these concepts and was tempted to skip the sessions😁, exercising self-restraint and following every step of the challenge was the best thing I did. I got to learn new things and understood better, concepts I never really grasp.

I hope day 3 is even more fun!

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

Day 3 Of 30 - Building A Blackjack Game (Part-3)

Liz - Oct 2

Day 1 of 30 - I Built A Blackjack Game

Liz - Sep 30

Everyone says DeepSeek is cheaper, but I got tired of guessing the exact math. So I built a calculat

abarth23 - Apr 27

SolidJS 2.0 Async Data: A Deep Dive for React Devs

morellodev - Jul 16

How to Build a Portfolio Website That Actually Gets You Hired

muhammadfarhan.dev - Aug 21
chevron_left
1.6k Points • 38 Badges
Abuja, Nigeria • lizdesigns.vercel.app
8Posts
20Comments
8Connections
API and devTools documentation writer. Learning frontend web development and exploring Agentic AI.

... Show more

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!