This lesson we're going to be taking.
Cards from the deck that's already been randomized, so taking them off the top of the deck array and
then outputting them visually for the player to be able to see.
So we're gonna create a function that called that take card, and it's going to require some parameters
to be passed in so that we know what card we're taking and where we're placing the card.
So it's visually being able to see.
So it's going into the game dealer hand and then into the game dealer cards element.
And that's the same one that we constructed when we initiated the gameplay.
So it's going to be able to show the content in the dealer card area and I'll show you how this is going
to work.
And also, I want to have one last parameter.
And this is going to be whether it's visible or not.
So right now, it just be false.
So we'll make it visible because when we play blackjack, the dealers, one of the cards is going to
be hidden.
So we need to have that option as we're constructing the card in the visible area.
So the first parameter that we pass in was the hand.
The second one is the element where it's going to go.
And then the last one is going to be whether it's hidden or not.
So this could be a boolean value.
And creating a temporary elements.
So we're taking the first card off the deck.
So doing shift.
And this is built in into arrays and then console log.
Whatever the value of Tempus, and don't forget to add in the take card function, so the function name,
so it's automatically taking a card and slugging it down to the console when we press the deal.
So let's see what happens.
So we've got the diamonds, the five of diamonds being passed in.
And when we refresh, you can see that the first card in the deck is the queen of spades.
So I press deal.
And if I go down here, I just took the queen of spades off the deck.
So, I mean, sir, what I want to do is I want to add it in to whatever the hand is in the hand.
Again, remember, it's going to be the player's hand or the dealer's hand.
So this is the game, whatever that array object is gonna be associated with.
And we're passing that in to the take card.
So taking hand and using push, we're gonna push this new card into whatever hand it is.
So in this case, it's gonna go into the dealers.
And then we can console log out the contents of game.
The game object to see what's happening.
So it's clear that and deal.
And so within the dealer hand.
So if we go all the way down here, we see that.
Now we've got that first item is sitting in there.
And that's how we're going to be able to tell what contents are in each one of the hands.
So the dealers hand the player's hand.
And that's where we're going to be able to compare them.
When we check to see if we have a winner and we check to see what their score is.
So we need a way to show the card contents into the element.
And we need to know what card we're showing.
So let's create another function and pass in that value from temp.
So that will be the card.
And then we're also going to specify which element we want to show the card within.
And then let's create a function to handle the show card.
And we'll take care of actually visually showing the card in the upcoming lesson.
So go ahead and add in the ability to take a card and automatically take the card and have that output
into the console.
Be ready to move on to the next step.
And we're also going to add in a bunch of take cards because the dealer is going to get two cards.
The player is going to get two cards right off the top.
And that one is going to be visible.
And we'll take will handle all of the tweaking of the application later on.