diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a115879a6d51422652cbfc.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a115879a6d51422652cbfc.md index b05e6b5ed0d..3360c93b50d 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a115879a6d51422652cbfc.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a115879a6d51422652cbfc.md @@ -84,7 +84,7 @@ assert.equal(document.querySelector('#game')?.children?.length, 4); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a1166ed9a56d439c0770e7.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a1166ed9a56d439c0770e7.md index 31b5aab1949..0eac43fb139 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a1166ed9a56d439c0770e7.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a1166ed9a56d439c0770e7.md @@ -74,7 +74,7 @@ assert(document.querySelectorAll('#stats > .stat')?.[2]?.innerText === 'Gold: 50 let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23c1d505bfa13747c8a9b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23c1d505bfa13747c8a9b.md index 872f15c114d..17f15765aa0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23c1d505bfa13747c8a9b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23c1d505bfa13747c8a9b.md @@ -177,7 +177,7 @@ assert.equal(stat.innerText.trimEnd(), 'Gold: 50'); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23cb9bc467a147516b500.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23cb9bc467a147516b500.md index da746753d28..2607be95cff 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23cb9bc467a147516b500.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23cb9bc467a147516b500.md @@ -103,7 +103,7 @@ assert.equal(button3.innerText, 'Fight dragon'); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23d1c5f1c93161f3582ae.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23d1c5f1c93161f3582ae.md index d99fc9288ca..a5424bbf3f0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23d1c5f1c93161f3582ae.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a23d1c5f1c93161f3582ae.md @@ -126,7 +126,7 @@ assert.equal(spanId, 'monsterHealth'); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a2401b9842721796b72850.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a2401b9842721796b72850.md index 00ed710db32..c9a2b3d8323 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a2401b9842721796b72850.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a2401b9842721796b72850.md @@ -66,7 +66,7 @@ assert.equal(text.innerText, "Welcome to Dragon Repeller. You must defeat the dr let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24068d60b671847d1d4e2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24068d60b671847d1d4e2.md index 5e2699cd92f..697a961ebe4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24068d60b671847d1d4e2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24068d60b671847d1d4e2.md @@ -72,7 +72,7 @@ assert.equal(background, 'rgb(10, 10, 35)'); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a2409897ec621942234cf6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a2409897ec621942234cf6.md index d08f231f391..7e6e32a5fd4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a2409897ec621942234cf6.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a2409897ec621942234cf6.md @@ -90,7 +90,7 @@ body { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a240c67f3dbb1a1e6d95ee.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a240c67f3dbb1a1e6d95ee.md index 201820ab04a..ad386505588 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a240c67f3dbb1a1e6d95ee.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a240c67f3dbb1a1e6d95ee.md @@ -143,7 +143,7 @@ body { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24128d5e8af1b47ad1aab.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24128d5e8af1b47ad1aab.md index fe761e7f5dd..9a45437b3b7 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24128d5e8af1b47ad1aab.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24128d5e8af1b47ad1aab.md @@ -104,7 +104,7 @@ body { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24190868ca51c0b6e83c7.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24190868ca51c0b6e83c7.md index 4d2f4e4141a..147905bc8f0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24190868ca51c0b6e83c7.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a24190868ca51c0b6e83c7.md @@ -132,7 +132,7 @@ body { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a241df03c1f61ce936f5d9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a241df03c1f61ce936f5d9.md index 9edacf0701a..7e575e0125c 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a241df03c1f61ce936f5d9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a241df03c1f61ce936f5d9.md @@ -106,7 +106,7 @@ body { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3a7e4f1060e2fc5ffb34b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3a7e4f1060e2fc5ffb34b.md index 7ccd56b9984..8c73975833f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3a7e4f1060e2fc5ffb34b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3a7e4f1060e2fc5ffb34b.md @@ -7,32 +7,32 @@ dashedName: step-8 # --description-- -Create another variable called `currentWeapon` and set it to `0`. +Create another variable called `currentWeaponIndex` and set it to `0`. # --hints-- -You should use `let` to declare a variable called `currentWeapon`. +You should use `let` to declare a variable called `currentWeaponIndex`. ```js -assert.match(code, /let\s+currentWeapon/i); +assert.match(code, /let\s+currentWeaponIndex/i); ``` You should use camelCase to name your variable. ```js -assert.match(code, /currentWeapon/); +assert.match(code, /currentWeaponIndex/); ``` -Your `currentWeapon` variable should be set to `0`. +Your `currentWeaponIndex` variable should be set to `0`. ```js -assert.equal(currentWeapon, 0); +assert.equal(currentWeaponIndex, 0); ``` You should initialize your variable to `0`. ```js -assert.match(code, /let\s+currentWeapon\s*=\s*0/); +assert.match(code, /let\s+currentWeaponIndex\s*=\s*0/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b3eab50e193608c19fc6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b3eab50e193608c19fc6.md index 8f0a454900e..e0d02c9c36b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b3eab50e193608c19fc6.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b3eab50e193608c19fc6.md @@ -54,6 +54,6 @@ assert.match(code, /let\s+fighting\s*;?/); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; --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/62a3b41c9494f937560640ab.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b41c9494f937560640ab.md index 2a4b553972f..34d9459ba8c 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b41c9494f937560640ab.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b41c9494f937560640ab.md @@ -93,7 +93,7 @@ assert.include(inventory, "stick"); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; --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/62a3b79d520a7f3d0e25afd6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b79d520a7f3d0e25afd6.md index d75e6619d33..e13e235a23c 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b79d520a7f3d0e25afd6.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b79d520a7f3d0e25afd6.md @@ -75,7 +75,7 @@ assert.match(code, /querySelector\(\s*('|")#button1\1\s*\)/); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3bb9aeefe4b3fc43c6d7b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3bb9aeefe4b3fc43c6d7b.md index 63b8f3a8475..9caf7e829c1 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3bb9aeefe4b3fc43c6d7b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3bb9aeefe4b3fc43c6d7b.md @@ -61,7 +61,7 @@ assert.deepEqual(button1, document.querySelector("#button1")); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3bec30ea7f941412512dc.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3bec30ea7f941412512dc.md index 491cbbb3fe3..01d81e0c3b4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3bec30ea7f941412512dc.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3bec30ea7f941412512dc.md @@ -176,7 +176,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c0ab883fd9435cd5c518.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c0ab883fd9435cd5c518.md index 88bcd739238..4e05e0cab79 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c0ab883fd9435cd5c518.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c0ab883fd9435cd5c518.md @@ -122,7 +122,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c2fccf186146b59c6e96.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c2fccf186146b59c6e96.md index b1c4d1d1b36..92af71dab77 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c2fccf186146b59c6e96.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c2fccf186146b59c6e96.md @@ -128,7 +128,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c4a0e52767482c5202d4.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c4a0e52767482c5202d4.md index 32cd3d6a758..1a0976099be 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c4a0e52767482c5202d4.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c4a0e52767482c5202d4.md @@ -144,7 +144,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c668afc43b4a134cca81.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c668afc43b4a134cca81.md index 019bf2cdced..35f1185c211 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c668afc43b4a134cca81.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c668afc43b4a134cca81.md @@ -132,7 +132,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c8bf3980c14c438d2aed.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c8bf3980c14c438d2aed.md index 8e7b3cc1e77..3a7680c0091 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c8bf3980c14c438d2aed.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c8bf3980c14c438d2aed.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c91a2bab1b4d6fabb726.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c91a2bab1b4d6fabb726.md index 2638ce9ae52..ecd7b41e551 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c91a2bab1b4d6fabb726.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c91a2bab1b4d6fabb726.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cdb11478a34ff4a6470d.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cdb11478a34ff4a6470d.md index 46025e90ee2..4899b136971 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cdb11478a34ff4a6470d.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cdb11478a34ff4a6470d.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cfc8328d3351b95d4f61.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cfc8328d3351b95d4f61.md index a1779a579fa..af1ce60c93d 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cfc8328d3351b95d4f61.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cfc8328d3351b95d4f61.md @@ -143,7 +143,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7beb1ad61211ac153707f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7beb1ad61211ac153707f.md index 7c76591109f..1e0c4282c4f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7beb1ad61211ac153707f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7beb1ad61211ac153707f.md @@ -148,7 +148,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bf06d2ad9d1c5024e833.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bf06d2ad9d1c5024e833.md index 2be712694cf..a5fcd2f1dec 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bf06d2ad9d1c5024e833.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bf06d2ad9d1c5024e833.md @@ -174,7 +174,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfabe119461eb13ccbd6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfabe119461eb13ccbd6.md index cc90d211dd4..6040d1028d3 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfabe119461eb13ccbd6.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfabe119461eb13ccbd6.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfd9179b7f1f6a15fb1e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfd9179b7f1f6a15fb1e.md index b0dfcbb9d7b..2998105596f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfd9179b7f1f6a15fb1e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfd9179b7f1f6a15fb1e.md @@ -136,7 +136,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c011eef9fb2084b966db.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c011eef9fb2084b966db.md index d1a2df0ea4b..1210d1b0e3b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c011eef9fb2084b966db.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c011eef9fb2084b966db.md @@ -116,7 +116,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c071219da921758a35bb.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c071219da921758a35bb.md index 5b43ac85352..752b1671817 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c071219da921758a35bb.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c071219da921758a35bb.md @@ -144,7 +144,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c23e6b511f22ed71197a.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c23e6b511f22ed71197a.md index f31a581cc2d..1086d92ce39 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c23e6b511f22ed71197a.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c23e6b511f22ed71197a.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7cc99577fbf25ee7a7d76.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7cc99577fbf25ee7a7d76.md index 353d61ea5b0..9fa40be79c3 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7cc99577fbf25ee7a7d76.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7cc99577fbf25ee7a7d76.md @@ -130,7 +130,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8a929e4260d08093756d2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8a929e4260d08093756d2.md index e4b0df5daaf..94c7436b55f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8a929e4260d08093756d2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8a929e4260d08093756d2.md @@ -121,7 +121,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8a9d876b2580943ba9351.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8a9d876b2580943ba9351.md index 3c65c2afa02..46c14435a3e 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8a9d876b2580943ba9351.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8a9d876b2580943ba9351.md @@ -128,7 +128,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ab0e27cbaf0b54ba8a42.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ab0e27cbaf0b54ba8a42.md index 606ba8b880f..d1ff821cb2e 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ab0e27cbaf0b54ba8a42.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ab0e27cbaf0b54ba8a42.md @@ -139,7 +139,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ac194679e60cb561b0a8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ac194679e60cb561b0a8.md index c318e051bc8..4ed6343fd96 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ac194679e60cb561b0a8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ac194679e60cb561b0a8.md @@ -132,7 +132,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ad8e01d7cb0deae5ec66.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ad8e01d7cb0deae5ec66.md index 4337bbb7817..442032d8950 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ad8e01d7cb0deae5ec66.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ad8e01d7cb0deae5ec66.md @@ -136,7 +136,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ade9b2f5b30ef0b606c2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ade9b2f5b30ef0b606c2.md index 84e25aa3479..75a9b22ce50 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ade9b2f5b30ef0b606c2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ade9b2f5b30ef0b606c2.md @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ae85fcaedc0fddc7ca4f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ae85fcaedc0fddc7ca4f.md index b3d8e3a6ced..cb2e7bdaeaa 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ae85fcaedc0fddc7ca4f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ae85fcaedc0fddc7ca4f.md @@ -171,7 +171,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b0b5053f16111b0b6b5f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b0b5053f16111b0b6b5f.md index 76419553abe..05f08bb6a19 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b0b5053f16111b0b6b5f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b0b5053f16111b0b6b5f.md @@ -154,7 +154,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b1762b7775124622e1a3.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b1762b7775124622e1a3.md index 6a2fd6dd18e..60ab0a2b874 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b1762b7775124622e1a3.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b1762b7775124622e1a3.md @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b3cc436db8139cc5fc09.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b3cc436db8139cc5fc09.md index ee22bd5db18..44fd2f7eb9c 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b3cc436db8139cc5fc09.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b3cc436db8139cc5fc09.md @@ -114,7 +114,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b6536156c51500739b41.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b6536156c51500739b41.md index 42fa1b7156b..1dc5232b378 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b6536156c51500739b41.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b6536156c51500739b41.md @@ -128,7 +128,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b711ab7a12161c7d9b67.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b711ab7a12161c7d9b67.md index 6df6d825b45..b54ee029164 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b711ab7a12161c7d9b67.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b711ab7a12161c7d9b67.md @@ -114,7 +114,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b9770050d217d2247801.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b9770050d217d2247801.md index 64dbdadcc64..5dbb6907d42 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b9770050d217d2247801.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b9770050d217d2247801.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c0c8313e891a15ec23e7.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c0c8313e891a15ec23e7.md index 69288ecb4e1..88610822650 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c0c8313e891a15ec23e7.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c0c8313e891a15ec23e7.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c1154d3ae11aee80353f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c1154d3ae11aee80353f.md index 91dac7f2a0f..38e22ada1ec 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c1154d3ae11aee80353f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c1154d3ae11aee80353f.md @@ -136,7 +136,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c151b23bf21bc7c4fcba.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c151b23bf21bc7c4fcba.md index 0bc2ea4f339..9eecaaee678 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c151b23bf21bc7c4fcba.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c151b23bf21bc7c4fcba.md @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c173949f851c83c64756.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c173949f851c83c64756.md index 7e8b7d6f71e..1848eab1431 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c173949f851c83c64756.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c173949f851c83c64756.md @@ -114,7 +114,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c242b25a531f2909e5bc.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c242b25a531f2909e5bc.md index cb1dab4a818..dda03f4aa4a 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c242b25a531f2909e5bc.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c242b25a531f2909e5bc.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c2bbbd8aa82052f47c53.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c2bbbd8aa82052f47c53.md index 87f4686de53..1b71205f170 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c2bbbd8aa82052f47c53.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c2bbbd8aa82052f47c53.md @@ -160,7 +160,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c31ec0ec78216a1c36a0.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c31ec0ec78216a1c36a0.md index b0c4f008224..eb77b88b3b0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c31ec0ec78216a1c36a0.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c31ec0ec78216a1c36a0.md @@ -126,7 +126,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c370ad8c68227137e0bc.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c370ad8c68227137e0bc.md index 7f9be4c607c..10e1f6ce3fa 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c370ad8c68227137e0bc.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c370ad8c68227137e0bc.md @@ -116,7 +116,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c3ebc6c35e23785e1a19.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c3ebc6c35e23785e1a19.md index 43844bfd6fa..2ea876ddf24 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c3ebc6c35e23785e1a19.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c3ebc6c35e23785e1a19.md @@ -114,7 +114,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c41ecaf1bd24536129b8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c41ecaf1bd24536129b8.md index 407ef30337e..addf8147369 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c41ecaf1bd24536129b8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c41ecaf1bd24536129b8.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c465fa7b0c252f4a8f0c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c465fa7b0c252f4a8f0c.md index b32a4624174..83b34def3df 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c465fa7b0c252f4a8f0c.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c465fa7b0c252f4a8f0c.md @@ -132,7 +132,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c4db0710f3260f867a92.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c4db0710f3260f867a92.md index 1ae8eed2293..dbc97e78aa9 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c4db0710f3260f867a92.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c4db0710f3260f867a92.md @@ -129,7 +129,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c5db7888af27af23f0dd.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c5db7888af27af23f0dd.md index 23684174766..c2df7ba8924 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c5db7888af27af23f0dd.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c5db7888af27af23f0dd.md @@ -123,7 +123,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c65b75664c28a8e59c16.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c65b75664c28a8e59c16.md index a5108647216..e35ee493c6b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c65b75664c28a8e59c16.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c65b75664c28a8e59c16.md @@ -115,7 +115,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c6815f5f1a29735efe1b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c6815f5f1a29735efe1b.md index df552626f1b..adad93a5c6b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c6815f5f1a29735efe1b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c6815f5f1a29735efe1b.md @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7322e42962ad53ad204.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7322e42962ad53ad204.md index 9a18056f74e..470f9065bec 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7322e42962ad53ad204.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7322e42962ad53ad204.md @@ -143,7 +143,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7a59e72c02bb1c717d2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7a59e72c02bb1c717d2.md index 57cf505e52b..bb8a07042e3 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7a59e72c02bb1c717d2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7a59e72c02bb1c717d2.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c89e4272512d44fc1c66.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c89e4272512d44fc1c66.md index a210376fd75..b3592e5aa14 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c89e4272512d44fc1c66.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c89e4272512d44fc1c66.md @@ -122,7 +122,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md index 641048de2e1..0f65c77df04 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md @@ -7,34 +7,34 @@ dashedName: step-84 # --description-- -The value of the `currentWeapon` variable corresponds to an index in the `weapons` array. The player starts with a `"stick"`, since `currentWeapon` starts at `0` and `weapons[0]` is the `"stick"` weapon. +The value of the `currentWeaponIndex` variable corresponds to an index in the `weapons` array. The player starts with a `"stick"`, since `currentWeaponIndex` starts at `0` and `weapons[0]` is the `"stick"` weapon. -In the `buyWeapon` function, use compound assignment to add `1` to `currentWeapon` - the user is buying the next weapon in the `weapons` array. +In the `buyWeapon` function, use compound assignment to add `1` to `currentWeaponIndex` - the user is buying the next weapon in the `weapons` array. # --hints-- -You should use compound assignment to add one to `currentWeapon`. +You should use compound assignment to add one to `currentWeaponIndex`. ```js -assert.match(buyWeapon.toString(), /currentWeapon\s*\+=\s*1/); +assert.match(buyWeapon.toString(), /currentWeaponIndex\s*\+=\s*1/); ``` -Your `buyWeapon` function should increase `currentWeapon` by `1`. +Your `buyWeapon` function should increase `currentWeaponIndex` by `1`. ```js gold = 30; -currentWeapon = 0; +currentWeaponIndex = 0; buyWeapon(); -assert.equal(currentWeapon, 1); +assert.equal(currentWeaponIndex, 1); ``` Your code should be in your `if` statement. ```js gold = 20; -currentWeapon = 0; +currentWeaponIndex = 0; buyWeapon(); -assert.equal(currentWeapon, 0); +assert.equal(currentWeaponIndex, 0); ``` # --seed-- @@ -126,7 +126,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ca22d29fe62f3952bdf5.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ca22d29fe62f3952bdf5.md index a4c118f6f3d..1bd4b3f4533 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ca22d29fe62f3952bdf5.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ca22d29fe62f3952bdf5.md @@ -16,20 +16,20 @@ num++; console.log(num); ``` -Change your `currentWeapon` assignment to use the increment operator. +Change your `currentWeaponIndex` assignment to use the increment operator. # --hints-- -You should use the increment operator to increase `currentWeapon` by `1`. +You should use the increment operator to increase `currentWeaponIndex` by `1`. ```js -assert.match(buyWeapon.toString(), /currentWeapon\s*\+\s*\+/); +assert.match(buyWeapon.toString(), /currentWeaponIndex\s*\+\s*\+/); ``` -You should not use compound assignment to increase `currentWeapon` by `1`. +You should not use compound assignment to increase `currentWeaponIndex` by `1`. ```js -assert.notMatch(buyWeapon.toString(), /currentWeapon\s*\+=\s*1/); +assert.notMatch(buyWeapon.toString(), /currentWeaponIndex\s*\+=\s*1/); ``` # --seed-- @@ -121,7 +121,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -209,7 +209,7 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon += 1; + currentWeaponIndex += 1; } } --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/62a8cb19bd7f8a304e5427a1.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cb19bd7f8a304e5427a1.md index 0288af76ebf..da2f57a2940 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cb19bd7f8a304e5427a1.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cb19bd7f8a304e5427a1.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -200,7 +200,7 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; } } --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/62a8cbd1e3595431d5a2b3f1.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cbd1e3595431d5a2b3f1.md index f2adb41b3a9..fb5a4c09d76 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cbd1e3595431d5a2b3f1.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cbd1e3595431d5a2b3f1.md @@ -125,7 +125,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -213,7 +213,7 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; text.innerText = "You now have a new weapon."; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cce1b0c32c33017cf2e9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cce1b0c32c33017cf2e9.md index 0ce8646d7ba..d72680595d4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cce1b0c32c33017cf2e9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cce1b0c32c33017cf2e9.md @@ -7,7 +7,7 @@ dashedName: step-88 # --description-- -Use bracket notation to access an object within the `weapons` array and assign it to your `newWeapon` variable. Place the variable `currentWeapon` within the brackets. +Use bracket notation to access an object within the `weapons` array and assign it to your `newWeapon` variable. Place the variable `currentWeaponIndex` within the brackets. When you use a variable in bracket notation, you are accessing the property or index by the *value* of that variable. @@ -19,10 +19,10 @@ let value = array[index]; # --hints-- -You should update `newWeapon` to have the value of `weapons[currentWeapon]`. +You should update `newWeapon` to have the value of `weapons[currentWeaponIndex]`. ```js -assert.match(buyWeapon.toString(), /newWeapon\s*=\s*weapons\s*\[\s*currentWeapon\s*\]/); +assert.match(buyWeapon.toString(), /newWeapon\s*=\s*weapons\s*\[\s*currentWeaponIndex\s*\]/); ``` # --seed-- @@ -114,7 +114,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -202,7 +202,7 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; let newWeapon = weapons; text.innerText = "You now have a new weapon."; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce1dfc990134162b3bd9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce1dfc990134162b3bd9.md index eb78febdb46..6f6157eec95 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce1dfc990134162b3bd9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce1dfc990134162b3bd9.md @@ -7,14 +7,14 @@ dashedName: step-89 # --description-- -`weapons[currentWeapon]` is an object. Use dot notation to get the `name` property of that object. +`weapons[currentWeaponIndex]` is an object. Use dot notation to get the `name` property of that object. # --hints-- -You should update `newWeapon` to have the value of `weapons[currentWeapon].name`. +You should update `newWeapon` to have the value of `weapons[currentWeaponIndex].name`. ```js -assert.match(buyWeapon.toString(), /newWeapon\s*=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.name\s*;?/); +assert.match(buyWeapon.toString(), /newWeapon\s*=\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.name\s*;?/); ``` # --seed-- @@ -106,7 +106,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -194,9 +194,9 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon]; + let newWeapon = weapons[currentWeaponIndex]; text.innerText = "You now have a new weapon."; } } diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce73d0dce43468f6689c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce73d0dce43468f6689c.md index 065a312d032..b4717bed9e8 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce73d0dce43468f6689c.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce73d0dce43468f6689c.md @@ -128,7 +128,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -216,9 +216,9 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a new weapon."; } } diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cf22272d6d35af80d4ac.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cf22272d6d35af80d4ac.md index 643d5f7346d..2191b5035b1 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cf22272d6d35af80d4ac.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cf22272d6d35af80d4ac.md @@ -35,7 +35,7 @@ Your `buyWeapon` function should add the value of `newWeapon` to the `inventory` ```js inventory = []; -currentWeapon = 0; +currentWeaponIndex = 0; buyWeapon(); assert.deepEqual(inventory, ["dagger"]); ``` @@ -129,7 +129,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -217,9 +217,9 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; } diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0337d7c67377a4a76c6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0337d7c67377a4a76c6.md index d81242da5a2..45c32476726 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0337d7c67377a4a76c6.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0337d7c67377a4a76c6.md @@ -121,7 +121,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -209,9 +209,9 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d08668fa8b38732486e9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d08668fa8b38732486e9.md index 049fa2470e9..baf137a8530 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d08668fa8b38732486e9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d08668fa8b38732486e9.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -200,9 +200,9 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: "; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0c4f12c2239b6618582.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0c4f12c2239b6618582.md index 0843051f507..47211f51cf4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0c4f12c2239b6618582.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0c4f12c2239b6618582.md @@ -127,7 +127,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -215,9 +215,9 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0fdf2dad83a92883a80.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0fdf2dad83a92883a80.md index 35bd5b0666b..cd43584c827 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0fdf2dad83a92883a80.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0fdf2dad83a92883a80.md @@ -7,20 +7,20 @@ dashedName: step-95 # --description-- -Once a player has the best weapon, they cannot buy another one. Wrap all of the code in your `buyWeapon` function inside another `if` statement. The condition should check if `currentWeapon` is less than `3` - the index of the last weapon. +Once a player has the best weapon, they cannot buy another one. Wrap all of the code in your `buyWeapon` function inside another `if` statement. The condition should check if `currentWeaponIndex` is less than `3` - the index of the last weapon. # --hints-- -You should have a new `if` statement that checks if `currentWeapon` is less than `3`. +You should have a new `if` statement that checks if `currentWeaponIndex` is less than `3`. ```js -assert.match(buyWeapon.toString(), /currentWeapon\s*\<\s*3/) +assert.match(buyWeapon.toString(), /currentWeaponIndex\s*\<\s*3/) ``` Your existing `if` statement should be within your new `if` statement. ```js -currentWeapon = 5; +currentWeaponIndex = 5; gold = 50; buyWeapon(); assert.equal(gold, 50); @@ -29,7 +29,7 @@ assert.equal(gold, 50); Your existing `else` statement should be within your new `if` statement. ```js -currentWeapon = 5; +currentWeaponIndex = 5; gold = 10; buyWeapon(); assert.notEqual(text.innerText, "You do not have enough gold to buy a weapon."); @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -212,9 +212,9 @@ function buyHealth() { function buyWeapon() { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d143f2a58e3b6d6e9c33.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d143f2a58e3b6d6e9c33.md index 71fd3d9c5b4..663cb53c8c4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d143f2a58e3b6d6e9c33.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d143f2a58e3b6d6e9c33.md @@ -9,7 +9,7 @@ dashedName: step-96 Arrays have a `length` property that returns the number of items in the array. You may want to add new values to the `weapons` array in the future. -Change your `if` condition to check if `currentWeapon` is less than the length of the `weapons` array. An example of checking the length of an array `myArray` would look like `myArray.length`. +Change your `if` condition to check if `currentWeaponIndex` is less than the length of the `weapons` array. An example of checking the length of an array `myArray` would look like `myArray.length`. # --hints-- @@ -19,10 +19,10 @@ You should use the `length` property on the `weapons` array. assert.match(buyWeapon.toString(), /weapons\.length/); ``` -Your `if` statement should check if `currentWeapon` is less than `weapons.length`. +Your `if` statement should check if `currentWeaponIndex` is less than `weapons.length`. ```js -assert.match(buyWeapon.toString(), /currentWeapon\s*<\s*weapons\.length/); +assert.match(buyWeapon.toString(), /currentWeaponIndex\s*<\s*weapons\.length/); ``` # --seed-- @@ -114,7 +114,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -200,12 +200,12 @@ function buyHealth() { --fcc-editable-region-- function buyWeapon() { - if (currentWeapon < 3) { + if (currentWeaponIndex < 3) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d1c72e8bb13c2074d93c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d1c72e8bb13c2074d93c.md index 00bcc81def5..4632b674d6f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d1c72e8bb13c2074d93c.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d1c72e8bb13c2074d93c.md @@ -9,7 +9,7 @@ dashedName: step-98 When you were testing your function, you should have seen an error message in the console. This error is due to the condition in the `buyWeapon` function. -The `currentWeapon` variable is the index of the `weapons` array, but array indexing starts at zero. The index of the last element in an array is one less than the length of the array. +The `currentWeaponIndex` variable is the index of the `weapons` array, but array indexing starts at zero. The index of the last element in an array is one less than the length of the array. Change the `if` condition to check `weapons.length - 1`, instead of `weapons.length`. @@ -23,10 +23,10 @@ You should update the condition to subtract `1` from `weapons.length`. assert.match(buyWeapon.toString(), /weapons\.length\s*-\s*1/); ``` -Your condition should check if `currentWeapon` is less than `weapons.length - 1`. +Your condition should check if `currentWeaponIndex` is less than `weapons.length - 1`. ```js -assert.match(buyWeapon.toString(), /currentWeapon\s*<\s*weapons\.length\s*-\s*1/); +assert.match(buyWeapon.toString(), /currentWeaponIndex\s*<\s*weapons\.length\s*-\s*1/); ``` # --seed-- @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 250; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -204,12 +204,12 @@ function buyHealth() { --fcc-editable-region-- function buyWeapon() { - if (currentWeapon < weapons.length) { + if (currentWeaponIndex < weapons.length) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2146a3e853d0a6e28ca.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2146a3e853d0a6e28ca.md index 88e988b4342..cc1c4b8273d 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2146a3e853d0a6e28ca.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2146a3e853d0a6e28ca.md @@ -31,7 +31,7 @@ assert.match(buyWeapon.toString(), /('|")You already have the most powerful weap You should modify your `text.innerText` to `"You already have the most powerful weapon!"` within your outer `else` statement. ```js -currentWeapon = 5; +currentWeaponIndex = 5; buyWeapon(); assert.equal(text.innerText, "You already have the most powerful weapon!"); ``` @@ -125,7 +125,7 @@ button { let xp = 0; let health = 100; let gold = 250; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -211,12 +211,12 @@ function buyHealth() { --fcc-editable-region-- function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d24c97461b3ddb9397c8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d24c97461b3ddb9397c8.md index 7beafd0a495..041472b56b8 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d24c97461b3ddb9397c8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d24c97461b3ddb9397c8.md @@ -126,7 +126,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -212,12 +212,12 @@ function buyHealth() { --fcc-editable-region-- function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2e2a073be3edb46116f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2e2a073be3edb46116f.md index 194d6d2130b..cc73efed14f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2e2a073be3edb46116f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2e2a073be3edb46116f.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -197,12 +197,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d31ebbc10e3fe1b28e03.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d31ebbc10e3fe1b28e03.md index a23450f5ed4..763f646b62b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d31ebbc10e3fe1b28e03.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d31ebbc10e3fe1b28e03.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -197,12 +197,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d35660db4040ba292193.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d35660db4040ba292193.md index 0d176b81c7f..975c6446f0f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d35660db4040ba292193.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d35660db4040ba292193.md @@ -121,7 +121,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -206,12 +206,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d382cd075f4169223e14.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d382cd075f4169223e14.md index a98797fee15..93b5c9babb8 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d382cd075f4169223e14.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d382cd075f4169223e14.md @@ -9,10 +9,6 @@ dashedName: step-105 The next step is to create a variable called `currentWeapon`. -Notice that you already have a `currentWeapon` variable elsewhere in your code. Since this new `currentWeapon` variable will be inside an `if` statement, it will be scoped only to that block of code. - -Scope is the term used to describe where a variable can be accessed. If a variable is declared inside a block of code, it is only accessible to the code inside that block. This is called block scope. - ```js let num = 1; if (num === 1) { @@ -121,7 +117,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -206,12 +202,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md index 4e7f9117a26..59e803ef18d 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md @@ -126,7 +126,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -211,12 +211,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d61ddfe35744369365b7.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d61ddfe35744369365b7.md index 0ce7ffb6314..d53accb8e69 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d61ddfe35744369365b7.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d61ddfe35744369365b7.md @@ -26,13 +26,13 @@ assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a \1/); You should add the value of `currentWeapon` to the `"You sold a "` string. Use the concatenation operator to do this on the same line. ```js -assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a\s\1\s*\+\s*\_currentWeapon/); +assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a\s\1\s*\+\s*currentWeapon/); ``` You should add the string `"."` to the value of `currentWeapon`. Use the concatenation operator to do this on the same line. ```js -assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a \1\s*\+\s*\_currentWeapon\s+\+\s+('|")\.\2/); +assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a \1\s*\+\s*currentWeapon\s+\+\s+('|")\.\2/); ``` Your `text.innerText` should update to the proper string. @@ -133,7 +133,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -218,12 +218,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d6c7001ebc45350e3d16.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d6c7001ebc45350e3d16.md index 44e4ab1926b..65721659631 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d6c7001ebc45350e3d16.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d6c7001ebc45350e3d16.md @@ -126,7 +126,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -211,12 +211,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d7b8ab568b4649998954.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d7b8ab568b4649998954.md index f5bbad9e0d1..682a5fe76bd 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d7b8ab568b4649998954.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d7b8ab568b4649998954.md @@ -120,7 +120,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -205,12 +205,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d81f539f004776dd9b1e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d81f539f004776dd9b1e.md index b92571d3d30..abd86e35b27 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d81f539f004776dd9b1e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d81f539f004776dd9b1e.md @@ -190,7 +190,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -274,12 +274,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd468debb449b4454086.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd468debb449b4454086.md index 7a5458fd606..1c6cd769027 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd468debb449b4454086.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd468debb449b4454086.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -210,12 +210,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd9cdb16324b04cfd958.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd9cdb16324b04cfd958.md index a1daed21eef..3b555e0f9f9 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd9cdb16324b04cfd958.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd9cdb16324b04cfd958.md @@ -120,7 +120,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -218,12 +218,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md index 331e94c38eb..39a1ab9c522 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -216,12 +216,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e0d1d0110b4ec421489f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e0d1d0110b4ec421489f.md index 2c8be2f2d00..9d1aebd3d08 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e0d1d0110b4ec421489f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e0d1d0110b4ec421489f.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -222,12 +222,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e142f7f0bd4fed898de3.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e142f7f0bd4fed898de3.md index c26c417f4d0..2312c7efe25 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e142f7f0bd4fed898de3.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e142f7f0bd4fed898de3.md @@ -136,7 +136,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -236,12 +236,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e1dc897df55108bcb5e8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e1dc897df55108bcb5e8.md index 507f9e51e21..96029139026 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e1dc897df55108bcb5e8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e1dc897df55108bcb5e8.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -216,12 +216,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e21398ad61520edb724f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e21398ad61520edb724f.md index eb32394270b..56b799d223d 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e21398ad61520edb724f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e21398ad61520edb724f.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -216,12 +216,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e24c673b075317cc0b09.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e24c673b075317cc0b09.md index a6385249c2a..b0452f35fd1 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e24c673b075317cc0b09.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e24c673b075317cc0b09.md @@ -129,7 +129,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -233,12 +233,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e271f8e3d1541f9624ad.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e271f8e3d1541f9624ad.md index 437ca16fc9b..2b27d636b1f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e271f8e3d1541f9624ad.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e271f8e3d1541f9624ad.md @@ -126,7 +126,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -230,12 +230,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e35675c18c56354c08cf.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e35675c18c56354c08cf.md index 178245eed00..437aa2e4fd0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e35675c18c56354c08cf.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e35675c18c56354c08cf.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -228,12 +228,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e41e2f190c58404dd46e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e41e2f190c58404dd46e.md index 00d88c00f07..601025a5d2f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e41e2f190c58404dd46e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e41e2f190c58404dd46e.md @@ -30,16 +30,16 @@ You should add the string `" You attack it with your "` to the `text.innerText` assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1/); ``` -You should use the concatenation operator to add the current weapon to the string. You can get the current weapon with `weapons[currentWeapon].name`. +You should use the concatenation operator to add the current weapon to the string. You can get the current weapon with `weapons[currentWeaponIndex].name`. ```js -assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.name/); +assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.name/); ``` You should use the concatenation operator to end your string with `"."`. ```js -assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.name\s*\+\s*('|")\.\2/); +assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.name\s*\+\s*('|")\.\2/); ``` # --seed-- @@ -131,7 +131,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -235,12 +235,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e45cc600c3591cee671a.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e45cc600c3591cee671a.md index c66f059b602..040babab4ec 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e45cc600c3591cee671a.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e45cc600c3591cee671a.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -216,12 +216,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -273,7 +273,7 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; } --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/62a8e49f4df7af5ae2d7a616.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md index 47cb6e49ba9..894b419ce25 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md @@ -9,7 +9,7 @@ dashedName: step-123 Set `monsterHealth` to `monsterHealth` minus the power of the player's current weapon. -Remember that you can access the power of the player's current weapon using `weapons[currentWeapon].power`. +Remember that you can access the power of the player's current weapon using `weapons[currentWeaponIndex].power`. # --hints-- @@ -19,22 +19,22 @@ You should use compound assignment to modify the `monsterHealth` variable. assert.match(attack.toString(), /monsterHealth\s*-=/); ``` -You should use bracket notation with `currentWeapon` to access `weapons`. +You should use bracket notation with `currentWeaponIndex` to access `weapons`. ```js -assert.match(attack.toString(), /weapons\s*\[\s*currentWeapon\s*\]/); +assert.match(attack.toString(), /weapons\s*\[\s*currentWeaponIndex\s*\]/); ``` -You should use dot notation to access the `power` property of `weapons[currentWeapon]`. +You should use dot notation to access the `power` property of `weapons[currentWeaponIndex]`. ```js -assert.match(attack.toString(), /weapons\s*\[\s*currentWeapon\s*\]\s*\.power/); +assert.match(attack.toString(), /weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.power/); ``` You should subtract the `power` of the current weapon from `monsterHealth`. ```js -assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power/); +assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.power/); ``` # --seed-- @@ -126,7 +126,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -230,12 +230,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -287,7 +287,7 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; } diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md index d59c6a933e7..6225b405f50 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md @@ -11,7 +11,7 @@ The `Math` object in JavaScript contains static properties and methods for mathe Using these, you can generate a random number within a range. For example, this generates a random number between `1` and `5`: `Math.floor(Math.random() * 5) + 1;`. -Following this pattern, use the addition operator (`+`) to add a random number between `1` and the value of `xp` to your `monsterHealth -= weapons[currentWeapon].power`. +Following this pattern, use the addition operator (`+`) to add a random number between `1` and the value of `xp` to your `monsterHealth -= weapons[currentWeaponIndex].power`. # --hints-- @@ -21,10 +21,10 @@ You should use the same `monsterHealth` line you already wrote. assert.lengthOf(attack.toString().match(/monsterHealth/g), 1); ``` -You should add to the `weapons[currentWeapon].power` value. +You should add to the `weapons[currentWeaponIndex].power` value. ```js -assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+/); +assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.power\s*\+/); ``` You should use `Math.floor()`. @@ -60,7 +60,7 @@ assert.match(attack.toString(), /Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp(? You should add the result of `Math.floor(Math.random() * xp) + 1` to the result of `weapons[currentWeapon].power`. ```js -assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp(?:\s*\+\s*1)?\s*\)(?:\s*\+ 1)?/); +assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp(?:\s*\+\s*1)?\s*\)(?:\s*\+ 1)?/); ``` # --seed-- @@ -152,7 +152,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -256,12 +256,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -313,10 +313,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; --fcc-editable-region-- - monsterHealth -= weapons[currentWeapon].power; + monsterHealth -= weapons[currentWeaponIndex].power; --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/62a8ed36d7a7915dfa444ba2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ed36d7a7915dfa444ba2.md index ca018a273a9..42f4f13e296 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ed36d7a7915dfa444ba2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ed36d7a7915dfa444ba2.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -228,12 +228,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -285,9 +285,9 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } --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/62a8edd05e27cc668051686f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8edd05e27cc668051686f.md index 4913ee7f562..716ea191491 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8edd05e27cc668051686f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8edd05e27cc668051686f.md @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -222,12 +222,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -279,9 +279,9 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee154c8946678775c4a4.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee154c8946678775c4a4.md index 5b971e7aaaf..7930bd5579f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee154c8946678775c4a4.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee154c8946678775c4a4.md @@ -128,7 +128,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -232,12 +232,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -289,9 +289,9 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee71f018e968a056d369.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee71f018e968a056d369.md index 3be7b4a8355..d7ef1c1dac8 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee71f018e968a056d369.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee71f018e968a056d369.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -228,12 +228,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -284,9 +284,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eec45f77bc69e8775294.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eec45f77bc69e8775294.md index d5af7299e44..ac255663e19 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eec45f77bc69e8775294.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eec45f77bc69e8775294.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -216,12 +216,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -272,9 +272,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eefe2e68b66ac563816b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eefe2e68b66ac563816b.md index 81d4dd2883d..0aede6aa27a 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eefe2e68b66ac563816b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eefe2e68b66ac563816b.md @@ -120,7 +120,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -224,12 +224,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -280,9 +280,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef6a52292f6bdca4f6f8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef6a52292f6bdca4f6f8.md index 110f82cbd5b..22817a6e62f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef6a52292f6bdca4f6f8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef6a52292f6bdca4f6f8.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -216,12 +216,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -272,9 +272,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef8f0c76a46cd221a68c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef8f0c76a46cd221a68c.md index a2391bac406..b83d89d1962 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef8f0c76a46cd221a68c.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef8f0c76a46cd221a68c.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -216,12 +216,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -272,9 +272,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8efb0e3ce826db8daf80f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8efb0e3ce826db8daf80f.md index d0556af9f84..affed6b0d2b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8efb0e3ce826db8daf80f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8efb0e3ce826db8daf80f.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -216,12 +216,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -272,9 +272,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eff21c0b0f6ebe5b8e38.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eff21c0b0f6ebe5b8e38.md index 3bca3e5c383..f6b904e02c3 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eff21c0b0f6ebe5b8e38.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eff21c0b0f6ebe5b8e38.md @@ -138,7 +138,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -244,12 +244,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -300,9 +300,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f06fb318666fef69f91e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f06fb318666fef69f91e.md index c1f3457b7c5..405a97fa6e2 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f06fb318666fef69f91e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f06fb318666fef69f91e.md @@ -114,7 +114,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -226,12 +226,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -282,9 +282,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f14fe6d1fc72454648c7.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f14fe6d1fc72454648c7.md index 3ad57b17036..5d78cc4d0b5 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f14fe6d1fc72454648c7.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f14fe6d1fc72454648c7.md @@ -120,7 +120,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -233,12 +233,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -289,9 +289,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f1d5f5ddbf74c07f733b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f1d5f5ddbf74c07f733b.md index 641e365bf76..9286fc33eb0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f1d5f5ddbf74c07f733b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f1d5f5ddbf74c07f733b.md @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -223,12 +223,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -279,9 +279,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f20463b324759953edad.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f20463b324759953edad.md index 5ff1b213382..22c13f88c2b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f20463b324759953edad.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f20463b324759953edad.md @@ -7,7 +7,7 @@ dashedName: step-138 # --description-- -At the end of your code, create a `restart` function. Inside this function, set `xp` to `0`, `health` to `100`, `gold` to `50`, `currentWeapon` to `0`, and set `inventory` to an array with the string `stick`. +At the end of your code, create a `restart` function. Inside this function, set `xp` to `0`, `health` to `100`, `gold` to `50`, `currentWeaponIndex` to `0`, and set `inventory` to an array with the string `stick`. Also update the `innerText` properties of `goldText`, `healthText`, and `xpText` to their current values. @@ -39,10 +39,10 @@ Your `restart` function should set `gold` to `50`. assert.match(restart.toString(), /gold\s*=\s*50/); ``` -Your `restart` function should set `currentWeapon` to `0`. +Your `restart` function should set `currentWeaponIndex` to `0`. ```js -assert.match(restart.toString(), /currentWeapon\s*=\s*0/); +assert.match(restart.toString(), /currentWeaponIndex\s*=\s*0/); ``` Your `restart` function should set `inventory` to an array with the string `"stick"`. @@ -164,7 +164,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -275,12 +275,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -331,9 +331,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f256b813a476cae51f49.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f256b813a476cae51f49.md index b16fffb51f2..9325032f3ea 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f256b813a476cae51f49.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f256b813a476cae51f49.md @@ -138,7 +138,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -255,12 +255,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -312,9 +312,9 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -345,7 +345,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 4e2d63fa3e4..bf52667c43c 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 @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -229,12 +229,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -285,9 +285,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -325,7 +325,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 5bb111d0b29..e318c25ce60 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 @@ -136,7 +136,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -255,12 +255,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -311,9 +311,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -351,7 +351,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 737e5a1a247..41faa44d5ef 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 @@ -108,7 +108,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -231,12 +231,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -288,9 +288,9 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -329,7 +329,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 1beebfe0ab7..b9f78edb5c3 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 @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -235,12 +235,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -291,9 +291,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -335,7 +335,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 e714aedc940..7b96177a6a6 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 @@ -120,7 +120,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -243,12 +243,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -299,9 +299,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -345,7 +345,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 b4f1daf80a0..f945040ccab 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 @@ -106,7 +106,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -229,12 +229,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -285,9 +285,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -331,7 +331,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 9ac019e464d..7194de8da02 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 @@ -121,7 +121,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -244,12 +244,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -300,9 +300,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -347,7 +347,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 648a7562e7c..ab5905353b1 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 @@ -136,7 +136,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -259,12 +259,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -315,9 +315,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -363,7 +363,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 1b7a89f353f..632abe728dd 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 @@ -106,7 +106,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -229,12 +229,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -286,10 +286,10 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -334,7 +334,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 19b06d036d3..100db541901 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 @@ -11,10 +11,10 @@ Move your `monsterHealth` assignment into your `if` block. # --hints-- -You should move your `monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1` into your `if` block. +You should move your `monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1` into your `if` block. ```js -assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\(\s*\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\+\s*1/) +assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\(\s*\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\+\s*1/) ``` # --seed-- @@ -106,7 +106,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -229,12 +229,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -286,12 +286,12 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { } - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -336,7 +336,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 a1775d7543b..e6ce6f4616a 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 @@ -14,13 +14,13 @@ Add an `else` statement to the first `if` statement inside your `attack()` funct You should add an `else` block after your `if (isMonsterHit())` block. ```js -assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\(\s*\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\+\s*1\s*;?\s*\}\s*else/) +assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\(\s*\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\+\s*1\s*;?\s*\}\s*else/) ``` You should add the text `" You miss."` to the end of `text.innerText`. Remember to use compound assignment and make sure there is a space before the word `You`. ```js -assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\(\s*\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\+\s*1\s*;?\s*\}\s*else\s*\{\s*text\.innerText\s*\+=\s*('|")\sYou miss\.\1/) +assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\(\s*\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\+\s*1\s*;?\s*\}\s*else\s*\{\s*text\.innerText\s*\+=\s*('|")\sYou miss\.\1/) ``` # --seed-- @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -235,12 +235,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -292,10 +292,10 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } healthText.innerText = health; monsterHealthText.innerText = monsterHealth; @@ -341,7 +341,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 1b9384de685..89b70f7c1b3 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 @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -235,12 +235,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -291,10 +291,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -345,7 +345,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 9219b8da936..3b985e1dbd3 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 @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -247,12 +247,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -303,10 +303,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -359,7 +359,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 4bca7930754..fcb4a8b153e 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 @@ -113,7 +113,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -236,12 +236,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -293,10 +293,10 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -349,7 +349,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 308f53fd795..9e1a123a719 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 @@ -131,7 +131,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -254,12 +254,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -311,10 +311,10 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -369,7 +369,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 0aecde7e233..28d47dffdff 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 @@ -15,7 +15,7 @@ num--; console.log(num); // Output: 9 ``` -Decrement the value of `currentWeapon` in your `if` statement, after you update the text. +Decrement the value of `currentWeaponIndex` in your `if` statement, after you update the text. # --hints-- @@ -25,10 +25,10 @@ You should use the decrement operator. assert.match(attack.toString(), /--/); ``` -You should decrement `currentWeapon` in your `if` statement. +You should decrement `currentWeaponIndex` in your `if` statement. ```js -assert.match(attack.toString(), /(currentWeapon\s*--\s*;?\s*}\s*})$/); +assert.match(attack.toString(), /(currentWeaponIndex\s*--\s*;?\s*}\s*})$/); ``` # --seed-- @@ -120,7 +120,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -243,12 +243,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -300,10 +300,10 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -359,7 +359,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 fb88f652092..aa926a8b8d8 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 @@ -128,7 +128,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -251,12 +251,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -308,10 +308,10 @@ function goFight() { --fcc-editable-region-- function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -328,7 +328,7 @@ function attack() { } if (Math.random() <= .1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } --fcc-editable-region-- @@ -367,7 +367,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 84e6671d449..0ab02c6d783 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 @@ -120,7 +120,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -243,12 +243,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -299,10 +299,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -319,7 +319,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -357,7 +357,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 f2c2ae3c598..705c25660dd 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 @@ -112,7 +112,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -235,12 +235,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -291,10 +291,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -311,7 +311,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -349,7 +349,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 4123ece8378..c1d224bb2dc 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 @@ -138,7 +138,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -261,12 +261,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -317,10 +317,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -337,7 +337,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -375,7 +375,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 9cf97ef1f86..8e5ad353975 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 @@ -136,7 +136,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -262,12 +262,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -318,10 +318,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -338,7 +338,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -376,7 +376,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 ae21c052d6e..7f603982c95 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 @@ -106,7 +106,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -235,12 +235,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -311,7 +311,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -349,7 +349,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 93b1c6df082..3a645ba89b2 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 @@ -120,7 +120,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -249,12 +249,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -305,10 +305,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -325,7 +325,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -363,7 +363,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 a674632b49b..a8fa573a795 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 @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -247,12 +247,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -303,10 +303,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -323,7 +323,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -361,7 +361,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 1ef1456647a..af13af000e3 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 @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -247,12 +247,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -303,10 +303,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -323,7 +323,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -361,7 +361,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 1eb6aa4c1f1..ee1f17b327b 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 @@ -106,7 +106,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -235,12 +235,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -291,10 +291,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -311,7 +311,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -349,7 +349,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 36d3ec72515..e579ddc37c0 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 @@ -129,7 +129,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -258,12 +258,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -314,10 +314,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -334,7 +334,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -372,7 +372,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 71875c1a0ea..6045c2ab02f 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 @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -253,12 +253,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -309,10 +309,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -329,7 +329,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -367,7 +367,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 5d2de454974..5c01ee608a2 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 @@ -125,7 +125,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -254,12 +254,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -310,10 +310,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -330,7 +330,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -368,7 +368,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 659e9a1e4b1..51a72303ff2 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 @@ -118,7 +118,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -247,12 +247,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -303,10 +303,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -323,7 +323,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -361,7 +361,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 b0868a55bf0..3b46e0900dc 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 @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -253,12 +253,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -309,10 +309,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -329,7 +329,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -367,7 +367,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 650fe59ddd1..d5cf53b8ad6 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 @@ -119,7 +119,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -248,12 +248,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -304,10 +304,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -324,7 +324,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -362,7 +362,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; 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 ebf70ca3d06..4f1db2ae242 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 @@ -484,7 +484,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -613,12 +613,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -669,10 +669,10 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= getMonsterAttackValue(monsters[fighting].level); if (isMonsterHit()) { - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; } else { text.innerText += " You miss."; } @@ -689,7 +689,7 @@ function attack() { } if (Math.random() <= .1 && inventory.length !== 1) { text.innerText += " Your " + inventory.pop() + " breaks."; - currentWeapon--; + currentWeaponIndex--; } } @@ -727,7 +727,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62b46e3a8d4be31be5af793d.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62b46e3a8d4be31be5af793d.md index db3e2b0cc04..e584e963759 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62b46e3a8d4be31be5af793d.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62b46e3a8d4be31be5af793d.md @@ -71,7 +71,7 @@ assert.equal(script.parentElement.tagName, "BODY"); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62ba17beef16c563069a65d8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62ba17beef16c563069a65d8.md index 94131282daa..040530eaf9a 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62ba17beef16c563069a65d8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62ba17beef16c563069a65d8.md @@ -138,7 +138,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -252,12 +252,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -308,9 +308,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -340,7 +340,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc1ee0c5a89717d4785729.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc1ee0c5a89717d4785729.md index f0978d9f11e..e2a20f27ac0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc1ee0c5a89717d4785729.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc1ee0c5a89717d4785729.md @@ -119,7 +119,7 @@ body { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc20387ef88d1d1998aac5.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc20387ef88d1d1998aac5.md index c38becdee8c..52cf362e9fa 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc20387ef88d1d1998aac5.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc20387ef88d1d1998aac5.md @@ -71,7 +71,7 @@ assert.deepEqual(button3, document.querySelector('#button3')); let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc211760bfc220f4734800.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc211760bfc220f4734800.md index 27be8c27ee8..3cb2f0de300 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc211760bfc220f4734800.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc211760bfc220f4734800.md @@ -114,7 +114,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6577ea4f23e3ba1217007bc7.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6577ea4f23e3ba1217007bc7.md index 4335e3d1542..d323d78445e 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6577ea4f23e3ba1217007bc7.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6577ea4f23e3ba1217007bc7.md @@ -140,7 +140,7 @@ body { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/65b2f6acce65b7a69751a090.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/65b2f6acce65b7a69751a090.md index 327151455ec..b796e1e966b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/65b2f6acce65b7a69751a090.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/65b2f6acce65b7a69751a090.md @@ -134,7 +134,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -254,12 +254,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; @@ -310,9 +310,9 @@ function goFight() { function attack() { text.innerText = "The " + monsters[fighting].name + " attacks."; - text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + "."; health -= monsters[fighting].level; - monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1; healthText.innerText = health; monsterHealthText.innerText = monsterHealth; if (health <= 0) { @@ -346,7 +346,7 @@ function restart() { xp = 0; health = 100; gold = 50; - currentWeapon = 0; + currentWeaponIndex = 0; inventory = ["stick"]; goldText.innerText = gold; healthText.innerText = health; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/660880e67dfed9eb6adb7178.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/660880e67dfed9eb6adb7178.md index f54857b4be9..2bd264ae1e8 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/660880e67dfed9eb6adb7178.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/660880e67dfed9eb6adb7178.md @@ -134,7 +134,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/66088382bd1422ed8b5309c3.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/66088382bd1422ed8b5309c3.md index cf7719f8bdd..8daa6c68d57 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/66088382bd1422ed8b5309c3.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/66088382bd1422ed8b5309c3.md @@ -132,7 +132,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/66088621742011f008175e5e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/66088621742011f008175e5e.md index 5e318ebe7e8..017ba23ed68 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/66088621742011f008175e5e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/66088621742011f008175e5e.md @@ -127,7 +127,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608b7985f4ba5127cbc401b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608b7985f4ba5127cbc401b.md index e98b6ce05c6..b53bf78e6c6 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608b7985f4ba5127cbc401b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608b7985f4ba5127cbc401b.md @@ -124,7 +124,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608b8713915f21398ff32e1.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608b8713915f21398ff32e1.md index ced19321751..05a2338d315 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608b8713915f21398ff32e1.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608b8713915f21398ff32e1.md @@ -140,7 +140,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608bee87c43ca194effebdf.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608bee87c43ca194effebdf.md index 6a86c63a1a2..8e4ba00e0fb 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608bee87c43ca194effebdf.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/6608bee87c43ca194effebdf.md @@ -114,7 +114,7 @@ button { let xp = 0; let health = 100; let gold = 50; -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/662fbead61552e06d30fc048.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/662fbead61552e06d30fc048.md index 24790e857fd..92e1bd1136a 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/662fbead61552e06d30fc048.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/662fbead61552e06d30fc048.md @@ -115,7 +115,7 @@ let health = 100; --fcc-editable-region-- let gold = 50; --fcc-editable-region-- -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -200,12 +200,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length) { + if (currentWeaponIndex < weapons.length) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/662fc372da60030ae25b194e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/662fc372da60030ae25b194e.md index 124c16a7e0b..980d04ab6b9 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/662fc372da60030ae25b194e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/662fc372da60030ae25b194e.md @@ -110,7 +110,7 @@ let health = 100; --fcc-editable-region-- let gold = 250; --fcc-editable-region-- -let currentWeapon = 0; +let currentWeaponIndex = 0; let fighting; let monsterHealth; let inventory = ["stick"]; @@ -195,12 +195,12 @@ function buyHealth() { } function buyWeapon() { - if (currentWeapon < weapons.length - 1) { + if (currentWeaponIndex < weapons.length - 1) { if (gold >= 30) { gold -= 30; - currentWeapon++; + currentWeaponIndex++; goldText.innerText = gold; - let newWeapon = weapons[currentWeapon].name; + let newWeapon = weapons[currentWeaponIndex].name; text.innerText = "You now have a " + newWeapon + "."; inventory.push(newWeapon); text.innerText += " In your inventory you have: " + inventory;