Closed Jlarranaga closed 11 months ago
Did you take a look at this repo?
Yes, I think I got it. I'll let you know if I can't get it. Thank you Timm!
Ok, i got the back of the card to show but now I cant get the front of the card to show properly in a different funciton.
`function duel(){ //TODO will handle button event and if two ranks are equal //TODO ...then call war function and winner function let pCardHtml = '' let cCardHtml = ''
const randPlayerIdx = Math.floor(Math.random() * pCards.length);
const randCompIdx = Math.floor(Math.random() * cCards.length);
const playerCard = pCards[randPlayerIdx]
const compCard = cCards[randCompIdx]
console.log(randPlayerIdx)
console.log(randCompIdx)
pCardHtml = `<div class="card ${playerCard}"></div>`
cCardHtml = `<div class="card ${compCard}"></div>`
console.log(playerCard)
console.log(compCard)
battlePlayerCard.innerHTML = pCardHtml
battleComputerCard.innerHTML = cCardHtml
//TODO return winner of the duel
//return duelWinner
}`
Hmm, let's take a look in a 1:1, I'll slack ya
` let pCardHtml = '' let cCardHtml = ''
const randPlayerIdx = Math.floor(Math.random() * pCards.length); //may need to +1 for 26 cards
const randCompIdx = Math.floor(Math.random() * cCards.length);
const pCard = pCards[randPlayerIdx]
const cCard = cCards[randCompIdx]
battlePCard = pCard.face
battleCCard = cCard.face
pCardHtml = `<div class="card ${battlePCard}"></div>`
cCardHtml = `<div class="card ${battleCCard}"></div>`
battlePlayerCard.innerHTML = pCardHtml
battleComputerCard.innerHTML = cCardHtml`
What's the problem you're trying to solve?
Trying to understand where 'Face' comes from and how to display the back of a card.
Post any code you think might be relevant (one fenced block per file)
If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
What is your best guess as to the source of the problem?
What things have you already tried to solve the problem?
Paste a link to your repository here
https://github.com/Jlarranaga/Project1-WAR