I'm making a card game and I dont know how to make the first card guess separate from the second card guess. I've looked at some examples on different codepens, but the code is kind of hard to understand. This is what I have so far..
var cards = [
"flower", "happy", "moon",
"rocket", "taco", "tree"
];
cards.forEach(function(card) {
$(`button.${card}`).click(function() {
var card1 = $(`button.${card}`).val();
var card2 = $(`button.${card}`).val();
console.log(`card1 is ${card1}`);
console.log(`card2 is ${card2}`);
});
});
Aucun commentaire:
Enregistrer un commentaire