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

Leader ●2 ●10 ●29
calendar_today • 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

My 30-day log cleanup kept a file that was 30 and a half days old

BashSnippets - Oct 8

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

Day 5 of 30 - Tip Calculator App (Part - 2)

Liz - Oct 8
chevron_left
1.6k Points • 41 Badges
Abuja, Nigeria • lizdesigns.vercel.app
9Posts
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!