- Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-
-
-
-
-```
-
-```css
-body {
- background-color: #0a0a23;
-}
-
-#text {
- background-color: #0a0a23;
- color: #ffffff;
- padding: 10px;
-}
-
-#game {
- max-width: 500px;
- max-height: 400px;
- background-color: #ffffff;
- color: #ffffff;
- margin: 30px auto 0px;
- padding: 10px;
-}
-
-#controls,
-#stats {
- border: 1px solid #0a0a23;
- padding: 5px;
- color: #0a0a23;
-}
-
-#monsterStats {
- display: none;
- border: 1px solid #0a0a23;
- padding: 5px;
- color: #ffffff;
- background-color: #c70d0d;
-}
-
-.stat {
- padding-right: 10px;
-}
-
-button {
- cursor: pointer;
- color: #0a0a23;
- background-color: #feac32;
- background-image: linear-gradient(#fecc4c, #ffac33);
- border: 3px solid #feac32;
-}
-```
-
-```js
-let xp = 0;
-let health = 100;
-let gold = 50;
-let currentWeapon = 0;
-let fighting;
-let monsterHealth;
-let inventory = ["stick"];
-
-const button1 = document.querySelector('#button1');
-const button2 = document.querySelector("#button2");
-const button3 = document.querySelector("#button3");
-const text = document.querySelector("#text");
-const xpText = document.querySelector("#xpText");
-const healthText = document.querySelector("#healthText");
-const goldText = document.querySelector("#goldText");
-const monsterStats = document.querySelector("#monsterStats");
-const monsterName = document.querySelector("#monsterName");
-const monsterHealthText = document.querySelector("#monsterHealth");
-const weapons = [
- { name: 'stick', power: 5 },
- { name: 'dagger', power: 30 },
- { name: 'claw hammer', power: 50 },
- { name: 'sword', power: 100 }
-];
-const monsters = [
- {
- name: "slime",
- level: 2,
- health: 15
- },
- {
- name: "fanged beast",
- level: 8,
- health: 60
- },
- {
- name: "dragon",
- level: 20,
- health: 300
- }
-]
-const locations = [
- {
- name: "town square",
- "button text": ["Go to store", "Go to cave", "Fight dragon"],
- "button functions": [goStore, goCave, fightDragon],
- text: "You are in the town square. You see a sign that says \"Store\"."
- },
- {
- name: "store",
- "button text": ["Buy 10 health (10 gold)", "Buy weapon (30 gold)", "Go to town square"],
- "button functions": [buyHealth, buyWeapon, goTown],
- text: "You enter the store."
- },
- {
- name: "cave",
- "button text": ["Fight slime", "Fight fanged beast", "Go to town square"],
- "button functions": [fightSlime, fightBeast, goTown],
- text: "You enter the cave. You see some monsters."
- },
- {
- name: "fight",
- "button text": ["Attack", "Dodge", "Run"],
- "button functions": [attack, dodge, goTown],
- text: "You are fighting a monster."
- },
- {
- name: "kill monster",
- "button text": ["Go to town square", "Go to town square", "Go to town square"],
- "button functions": [goTown, goTown, goTown],
- text: 'The monster screams "Arg!" as it dies. You gain experience points and find gold.'
- },
- {
- name: "lose",
- "button text": ["REPLAY?", "REPLAY?", "REPLAY?"],
- "button functions": [restart, restart, restart],
- text: "You die. ☠️"
- }
-];
-
-// initialize buttons
-button1.onclick = goStore;
-button2.onclick = goCave;
-button3.onclick = fightDragon;
-
-function update(location) {
- monsterStats.style.display = "none";
- button1.innerText = location["button text"][0];
- button2.innerText = location["button text"][1];
- button3.innerText = location["button text"][2];
- button1.onclick = location["button functions"][0];
- button2.onclick = location["button functions"][1];
- button3.onclick = location["button functions"][2];
- text.innerText = location.text;
-}
-
-function goTown() {
- update(locations[0]);
-}
-
-function goStore() {
- update(locations[1]);
-}
-
-function goCave() {
- update(locations[2]);
-}
-
-function buyHealth() {
- if (gold >= 10) {
- gold -= 10;
- health += 10;
- goldText.innerText = gold;
- healthText.innerText = health;
- } else {
- text.innerText = "You do not have enough gold to buy health.";
- }
-}
-
-function buyWeapon() {
- if (currentWeapon < weapons.length - 1) {
- if (gold >= 30) {
- gold -= 30;
- currentWeapon++;
- goldText.innerText = gold;
- let newWeapon = weapons[currentWeapon].name;
- text.innerText = "You now have a " + newWeapon + ".";
- inventory.push(newWeapon);
- text.innerText += " In your inventory you have: " + inventory;
- } else {
- text.innerText = "You do not have enough gold to buy a weapon.";
- }
- } else {
- text.innerText = "You already have the most powerful weapon!";
- button2.innerText = "Sell weapon for 15 gold";
- button2.onclick = sellWeapon;
- }
-}
-
-function sellWeapon() {
- if (inventory.length > 1) {
- gold += 15;
- goldText.innerText = gold;
- let currentWeapon = inventory.shift();
- text.innerText = "You sold a " + currentWeapon + ".";
- text.innerText += " In your inventory you have: " + inventory;
- } else {
- text.innerText = "Don't sell your only weapon!";
- }
-}
-
-function fightSlime() {
- fighting = 0;
- goFight();
-}
-
-function fightBeast() {
- fighting = 1;
- goFight();
-}
-
-function fightDragon() {
- fighting = 2;
- goFight();
-}
-
-function goFight() {
- update(locations[3]);
- monsterHealth = monsters[fighting].health;
- monsterStats.style.display = "block";
- monsterName.innerText = monsters[fighting].name;
- monsterHealthText.innerText = monsterHealth;
-}
-
---fcc-editable-region--
-function attack() {
- text.innerText = "The " + monsters[fighting].name + " attacks.";
- text.innerText += " You attack it with your " + weapons[currentWeapon].name + ".";
- health -= monsters[fighting].level;
- monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1;
- healthText.innerText = health;
- monsterHealthText.innerText = monsterHealth;
- if (health <= 0) {
- lose();
- } else if (monsterHealth <= 0) {
- if (fighting === 2) {
- winGame();
- } else {
- defeatMonster();
- }
- }
-}
---fcc-editable-region--
-
-function dodge() {
- text.innerText = "You dodge the attack from the " + monsters[fighting].name;
-}
-
-function defeatMonster() {
- gold += Math.floor(monsters[fighting].level * 6.7);
- xp += monsters[fighting].level;
- goldText.innerText = gold;
- xpText.innerText = xp;
- update(locations[4]);
-}
-
-function lose() {
- update(locations[5]);
-}
-
-function restart() {
- xp = 0;
- health = 100;
- gold = 50;
- currentWeapon = 0;
- inventory = ["stick"];
- goldText.innerText = gold;
- healthText.innerText = health;
- xpText.innerText = xp;
- goTown();
-}
-```
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f35bde1750791f58773f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f35bde1750791f58773f.md
index eae58bf7d92..20915deeea9 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f35bde1750791f58773f.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f35bde1750791f58773f.md
@@ -1,8 +1,8 @@
---
id: 62a8f35bde1750791f58773f
-title: Step 141
+title: Step 140
challengeType: 0
-dashedName: step-141
+dashedName: step-140
---
# --description--
@@ -293,7 +293,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a94114ce0b8918b487390f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a94114ce0b8918b487390f.md
index a0f8d016e2c..eec04aabc08 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a94114ce0b8918b487390f.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a94114ce0b8918b487390f.md
@@ -1,8 +1,8 @@
---
id: 62a94114ce0b8918b487390f
-title: Step 142
+title: Step 141
challengeType: 0
-dashedName: step-142
+dashedName: step-141
---
# --description--
@@ -319,7 +319,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1cea594f152ba626b872.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1cea594f152ba626b872.md
index b7ace748a18..b9e7fc214ee 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1cea594f152ba626b872.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1cea594f152ba626b872.md
@@ -1,8 +1,8 @@
---
id: 62aa1cea594f152ba626b872
-title: Step 143
+title: Step 142
challengeType: 0
-dashedName: step-143
+dashedName: step-142
---
# --description--
@@ -296,7 +296,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
--fcc-editable-region--
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d6736ba262cfa74344b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d6736ba262cfa74344b.md
index 80f404287cd..a2987282734 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d6736ba262cfa74344b.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d6736ba262cfa74344b.md
@@ -1,8 +1,8 @@
---
id: 62aa1d6736ba262cfa74344b
-title: Step 144
+title: Step 143
challengeType: 0
-dashedName: step-144
+dashedName: step-143
---
# --description--
@@ -299,7 +299,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d9f535e102e4663e7a6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d9f535e102e4663e7a6.md
index 3e12b584c96..0e5dc6b2afe 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d9f535e102e4663e7a6.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d9f535e102e4663e7a6.md
@@ -1,8 +1,8 @@
---
id: 62aa1d9f535e102e4663e7a6
-title: Step 145
+title: Step 144
challengeType: 0
-dashedName: step-145
+dashedName: step-144
---
# --description--
@@ -307,7 +307,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e3c7c3d552fb04f0f18.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e3c7c3d552fb04f0f18.md
index ac013d02994..4f8037ee81a 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e3c7c3d552fb04f0f18.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e3c7c3d552fb04f0f18.md
@@ -1,8 +1,8 @@
---
id: 62aa1e3c7c3d552fb04f0f18
-title: Step 146
+title: Step 145
challengeType: 0
-dashedName: step-146
+dashedName: step-145
---
# --description--
@@ -293,7 +293,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md
index a2b927b4aed..ce9c7a089b5 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md
@@ -1,8 +1,8 @@
---
id: 62aa1e8ccd579330e097ce44
-title: Step 147
+title: Step 146
challengeType: 0
-dashedName: step-147
+dashedName: step-146
---
# --description--
@@ -302,7 +302,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md
index 0ce540b379d..b94ef5f3929 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md
@@ -1,22 +1,30 @@
---
id: 62aa1eec891ed731db227a36
-title: Step 148
+title: Step 147
challengeType: 0
-dashedName: step-148
+dashedName: step-147
---
# --description--
-If you play the game in its current state you might notice a bug. If your `xp` is high enough, the `getMonsterAttackValue` function will return a negative number, which will actually add to your total health when fighting a monster!
+If you play the game in its current state you might notice a bug. If your `xp` is high enough, the `getMonsterAttackValue` function will return a negative number, which will actually add to your total health when fighting a monster! You can fix this issue by using a ternary operator to ensure negative values are not returned.
-In `getMonsterAttackValue`, change `return hit` to a ternary operator that returns `hit` if `hit` is greater than `0`, or returns `0` if it is not.
+The `ternary operator` is a conditional operator and can be used as a one-line `if-else` statement. The syntax is: `condition ? expressionIfTrue : expressionIfFalse`.
-Here is an example of returning a value based on `condition` with a ternary:
+Here is an example of returning a value using an `if-else` statement and a refactored example using a ternary operator:
```js
-return condition ? true : false;
+if (num > 5) {
+ return 'num is greater than 5';
+} else {
+ return 'num is smaller than or equal to 5';
+}
+
+return num > 5 ? 'num is greater than 5' : 'num is smaller than or equal to 5';
```
+In `getMonsterAttackValue`, change `return hit` to a ternary operator that returns `hit` if `hit` is greater than `0`, or returns `0` if it is not.
+
# --hints--
You should use a ternary to change the `return` value if `hit` is greater than `0`.
@@ -313,7 +321,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md
index 9fcb7c3f4ef..f17bf1d36e9 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md
@@ -1,8 +1,8 @@
---
id: 62aa1fed3d4e873366ff3131
-title: Step 149
+title: Step 148
challengeType: 0
-dashedName: step-149
+dashedName: step-148
---
# --description--
@@ -295,7 +295,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
--fcc-editable-region--
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md
index 535ad276703..fa5cafc28e5 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md
@@ -1,8 +1,8 @@
---
id: 62aa204c1e1d33348ff09944
-title: Step 150
+title: Step 149
challengeType: 0
-dashedName: step-150
+dashedName: step-149
---
# --description--
@@ -297,7 +297,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
--fcc-editable-region--
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md
index 0a30c512b35..3c1fc7c8177 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md
@@ -1,8 +1,8 @@
---
id: 62aa20e9cf1be9358f5aceae
-title: Step 151
+title: Step 150
challengeType: 0
-dashedName: step-151
+dashedName: step-150
---
# --description--
@@ -302,7 +302,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
--fcc-editable-region--
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md
index 2cf993d24c6..b88c3f105fd 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md
@@ -1,8 +1,8 @@
---
id: 62aa2136fc49b836dfedb959
-title: Step 152
+title: Step 151
challengeType: 0
-dashedName: step-152
+dashedName: step-151
---
# --description--
@@ -303,7 +303,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md
index ad3769d0124..005181853b8 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md
@@ -1,8 +1,8 @@
---
id: 62aa21971e3b743844849985
-title: Step 153
+title: Step 152
challengeType: 0
-dashedName: step-153
+dashedName: step-152
---
# --description--
@@ -315,7 +315,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md
index dd5caf50e3a..21217db6259 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md
@@ -1,8 +1,8 @@
---
id: 62aa21ea8d9d9f396b95dd87
-title: Step 154
+title: Step 153
challengeType: 0
-dashedName: step-154
+dashedName: step-153
---
# --description--
@@ -15,7 +15,7 @@ You should add an `if` statement to your `attack` function.
```js
const ifs = attack.toString().match(/if/g);
-assert.lengthOf(ifs, 4);
+assert.lengthOf(ifs, 5);
```
Your new `if` statement should check `Math.random() <= .1`.
@@ -305,7 +305,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
}
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md
index 3464cc77f3c..f0f84dde617 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md
@@ -1,8 +1,8 @@
---
id: 62aa226207f33d3ad4c6f546
-title: Step 155
+title: Step 154
challengeType: 0
-dashedName: step-155
+dashedName: step-154
---
# --description--
@@ -324,7 +324,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1) {
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md
index 762c2296bdf..99d1dc991d1 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md
@@ -1,8 +1,8 @@
---
id: 62aa22aba186563bcbf2c395
-title: Step 156
+title: Step 155
challengeType: 0
-dashedName: step-156
+dashedName: step-155
---
# --description--
@@ -306,7 +306,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md
index 9967eef197f..9e91cc4994b 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md
@@ -1,8 +1,8 @@
---
id: 62aa234322d4ad3e8bce42cc
-title: Step 157
+title: Step 156
challengeType: 0
-dashedName: step-157
+dashedName: step-156
---
# --description--
@@ -320,7 +320,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md
index aab2866b3ab..b81c76807d0 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md
@@ -1,8 +1,8 @@
---
id: 62aa2469c77b363fdb4f0e06
-title: Step 158
+title: Step 157
challengeType: 0
-dashedName: step-158
+dashedName: step-157
---
# --description--
@@ -311,7 +311,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md
index c64e2653385..25daf921e18 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md
@@ -1,8 +1,8 @@
---
id: 62aa252c3b1073415ba2b898
-title: Step 159
+title: Step 158
challengeType: 0
-dashedName: step-159
+dashedName: step-158
---
# --description--
@@ -303,7 +303,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md
index edbd610f2e9..f4542d34af7 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md
@@ -1,8 +1,8 @@
---
id: 62aa258da314ef42ba0a1858
-title: Step 160
+title: Step 159
challengeType: 0
-dashedName: step-160
+dashedName: step-159
---
# --description--
@@ -329,7 +329,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md
index 189fabe0972..06f04077385 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md
@@ -1,8 +1,8 @@
---
id: 62aa25fcb5837d43b4d9873d
-title: Step 161
+title: Step 160
challengeType: 0
-dashedName: step-161
+dashedName: step-160
---
# --description--
@@ -330,7 +330,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md
index 2cf421c97d0..71a3817c2b6 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md
@@ -1,8 +1,8 @@
---
id: 62aa2626c3c10244b94c787b
-title: Step 162
+title: Step 161
challengeType: 0
-dashedName: step-162
+dashedName: step-161
---
# --description--
@@ -303,7 +303,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa264d23cdaa45a20efada.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa264d23cdaa45a20efada.md
index a62af056c02..1be3d1a3569 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa264d23cdaa45a20efada.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa264d23cdaa45a20efada.md
@@ -1,8 +1,8 @@
---
id: 62aa264d23cdaa45a20efada
-title: Step 163
+title: Step 162
challengeType: 0
-dashedName: step-163
+dashedName: step-162
---
# --description--
@@ -319,7 +319,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa26cca3cd3d46c431e73b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa26cca3cd3d46c431e73b.md
index 1fc679623bd..a0485ad1ad1 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa26cca3cd3d46c431e73b.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa26cca3cd3d46c431e73b.md
@@ -1,8 +1,8 @@
---
id: 62aa26cca3cd3d46c431e73b
-title: Step 164
+title: Step 163
challengeType: 0
-dashedName: step-164
+dashedName: step-163
---
# --description--
@@ -315,7 +315,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27227399d647e1c37a3c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27227399d647e1c37a3c.md
index b01484438fc..86615b0c2c8 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27227399d647e1c37a3c.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27227399d647e1c37a3c.md
@@ -1,8 +1,8 @@
---
id: 62aa27227399d647e1c37a3c
-title: Step 165
+title: Step 164
challengeType: 0
-dashedName: step-165
+dashedName: step-164
---
# --description--
@@ -315,7 +315,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27560def7048d7b4a095.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27560def7048d7b4a095.md
index 51bd4ecba53..e2be1cda316 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27560def7048d7b4a095.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27560def7048d7b4a095.md
@@ -1,8 +1,8 @@
---
id: 62aa27560def7048d7b4a095
-title: Step 166
+title: Step 165
challengeType: 0
-dashedName: step-166
+dashedName: step-165
---
# --description--
@@ -303,7 +303,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27c40ca6f04ab8be5fac.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27c40ca6f04ab8be5fac.md
index 8ef41155a20..055d91d2057 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27c40ca6f04ab8be5fac.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27c40ca6f04ab8be5fac.md
@@ -1,8 +1,8 @@
---
id: 62aa27c40ca6f04ab8be5fac
-title: Step 167
+title: Step 166
challengeType: 0
-dashedName: step-167
+dashedName: step-166
---
# --description--
@@ -309,7 +309,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28032d863d4bd8058799.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28032d863d4bd8058799.md
index 5c292296537..f69dd2bf045 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28032d863d4bd8058799.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28032d863d4bd8058799.md
@@ -1,8 +1,8 @@
---
id: 62aa28032d863d4bd8058799
-title: Step 168
+title: Step 167
challengeType: 0
-dashedName: step-168
+dashedName: step-167
---
# --description--
@@ -307,7 +307,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa287434dc284cea01157c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa287434dc284cea01157c.md
index ba44cbf4b1c..06b25eaae9f 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa287434dc284cea01157c.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa287434dc284cea01157c.md
@@ -1,8 +1,8 @@
---
id: 62aa287434dc284cea01157c
-title: Step 169
+title: Step 168
challengeType: 0
-dashedName: step-169
+dashedName: step-168
---
# --description--
@@ -305,7 +305,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28bbd6323e4dfb3ac43e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28bbd6323e4dfb3ac43e.md
index faa7a16f97d..5cef7a56d2e 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28bbd6323e4dfb3ac43e.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28bbd6323e4dfb3ac43e.md
@@ -1,8 +1,8 @@
---
id: 62aa28bbd6323e4dfb3ac43e
-title: Step 170
+title: Step 169
challengeType: 0
-dashedName: step-170
+dashedName: step-169
---
# --description--
@@ -305,7 +305,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28fb651bf14efa2dbb16.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28fb651bf14efa2dbb16.md
index faaf7e89030..27ac238839d 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28fb651bf14efa2dbb16.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28fb651bf14efa2dbb16.md
@@ -1,8 +1,8 @@
---
id: 62aa28fb651bf14efa2dbb16
-title: Step 171
+title: Step 170
challengeType: 0
-dashedName: step-171
+dashedName: step-170
---
# --description--
@@ -322,7 +322,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2943669c9d5026af6985.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2943669c9d5026af6985.md
index 2fcff31504e..e29c06d8dc5 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2943669c9d5026af6985.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2943669c9d5026af6985.md
@@ -1,8 +1,8 @@
---
id: 62aa2943669c9d5026af6985
-title: Step 172
+title: Step 171
challengeType: 0
-dashedName: step-172
+dashedName: step-171
---
# --description--
@@ -322,7 +322,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md
index 2b6038af9d7..74f8057e55d 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md
@@ -1,8 +1,8 @@
---
id: 62aa2999ec27ec516655eba6
-title: Step 173
+title: Step 172
challengeType: 0
-dashedName: step-173
+dashedName: step-172
---
# --description--
@@ -315,7 +315,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa29d8f8f88152c91350ca.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa29d8f8f88152c91350ca.md
index 9a5bd196d85..1e779063c89 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa29d8f8f88152c91350ca.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa29d8f8f88152c91350ca.md
@@ -1,8 +1,8 @@
---
id: 62aa29d8f8f88152c91350ca
-title: Step 174
+title: Step 173
challengeType: 0
-dashedName: step-174
+dashedName: step-173
---
# --description--
@@ -321,7 +321,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md
index 3b019b25cfc..1c42394c53e 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md
@@ -1,8 +1,8 @@
---
id: 62aa2aec2f09d454253aad6c
-title: Step 175
+title: Step 174
challengeType: 0
-dashedName: step-175
+dashedName: step-174
---
# --description--
@@ -316,7 +316,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2ba9cd881355a6f0a5a8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2ba9cd881355a6f0a5a8.md
index 78c6f50f637..152d93e7948 100644
--- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2ba9cd881355a6f0a5a8.md
+++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2ba9cd881355a6f0a5a8.md
@@ -1,8 +1,8 @@
---
id: 62aa2ba9cd881355a6f0a5a8
-title: Step 176
+title: Step 175
challengeType: 0
-dashedName: step-176
+dashedName: step-175
---
# --description--
@@ -307,7 +307,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";
@@ -677,7 +681,11 @@ function attack() {
if (health <= 0) {
lose();
} else if (monsterHealth <= 0) {
- fighting === 2 ? winGame() : defeatMonster();
+ if (fighting === 2) {
+ winGame();
+ } else {
+ defeatMonster();
+ }
}
if (Math.random() <= .1 && inventory.length !== 1) {
text.innerText += " Your " + inventory.pop() + " breaks.";