Skip to content

Commit 98d531e

Browse files
committed
Fix conditional logic
1 parent 5c6a07f commit 98d531e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ generateRandomCardButton.addEventListener("click", () => {
5151
? 0.025
5252
: 0; //add card weight to weight sum
5353
if (
54-
number <= totalWeight ||
55-
(number <= weightSum && cards.length > 0)
54+
(number <= totalWeight || number <= weightSum) &&
55+
cards.length > 0
5656
) {
5757
//if random number is less than or equal to weight sum
5858
randomCardOutput.innerText = `You got a ${card.rarity} card: ${card.name}`; //display generated random card

0 commit comments

Comments
 (0)