diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-001.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-001.md deleted file mode 100644 index a50816dd7c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-001.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -id: 5d5a813321b9e3db6c106a46 -title: Part 1 -challengeType: 0 -dashedName: part-1 ---- - -# --description-- - -To keep track of the player's experience points, we've declared a variable called `xp` and assigned it the starting value of 0. - -Create another variable to keep track of health and start it at 100. - -# --hints-- - -See description above for instructions. - -```js -assert(health === 100); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-002.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-002.md deleted file mode 100644 index 0127056186..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-002.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -id: 5d5a8dd907f328a948d398ce -title: Part 2 -challengeType: 0 -dashedName: part-2 ---- - -# --description-- - -Create a variable called `gold` and set it to the value 50. - -# --hints-- - -See description above for instructions. - -```js -assert(gold === 50); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-003.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-003.md deleted file mode 100644 index 5e416ceb17..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-003.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -id: 5d5a8f1c07f328a948d398cf -title: Part 3 -challengeType: 0 -dashedName: part-3 ---- - -# --description-- - -Create a variable called `currentWeapon` and set it to 0. When a name has two words, the convention is to use so-called "lowerCamelCase". The first word is all lowercase, and then the first letter of every preceding word is uppercased. - -When a name has two words, the convention is to use so-called "lowerCamelCase". The variable name should look like this: currentWeapon. - -# --hints-- - -See description above for instructions. - -```js -assert(currentWeapon === 0); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-004.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-004.md deleted file mode 100644 index 01e3ae0136..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-004.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -id: 5d5a903507f328a948d398d0 -title: Part 4 -challengeType: 0 -dashedName: part-4 ---- - -# --description-- - -We've been declaring variables with the `var` keyword. However, in modern JavaScript, it's better to use `let` instead of `var` because it fixes a number of unusual behaviors with `var` that make it difficult to reason about. - -Change every `var` to `let`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /let\s+xp\s*\=\s*0\;?/.test(code) && - /let\s+health\s*\=\s*100\;?/.test(code) && - /let\s+gold\s*\=\s*50\;?/.test(code) && - /let\s+currentWeapon\s*\=\s*0\;?/.test(code) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-005.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-005.md deleted file mode 100644 index 952c282390..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-005.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -id: 5d5aaa5807f328a948d398d1 -title: Part 5 -challengeType: 0 -dashedName: part-5 ---- - -# --description-- - -Now you will declare a variable without initializing it. - -Using the `let` keyword, declare a variable called `fighting` but don't set it equal to anything. Just end the line with a semicolon right after the variable name. - -# --hints-- - -See description above for instructions. - -```js -assert(/let\s+fighting\s*;?/.test(code) && fighting === undefined); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-006.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-006.md deleted file mode 100644 index 1ee50c18f0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-006.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -id: 5d5aab5d07f328a948d398d2 -title: Part 6 -challengeType: 0 -dashedName: part-6 ---- - -# --description-- - -Declare variables named `monsterHealth` and `inventory` without initializing them. - -# --hints-- - -See description above for instructions. - -```js -assert(monsterHealth === undefined && inventory === undefined); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-007.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-007.md deleted file mode 100644 index 2053d6cc09..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-007.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -id: 5d5aac9c07f328a948d398d3 -title: Part 7 -challengeType: 0 -dashedName: part-7 ---- - -# --description-- - -Now set the inventory to equal the string "stick". - -Strings must be surrounded with double quotes `"`, single quotes `'`, or backticks `` ` ``. - -# --hints-- - -See description above for instructions. - -```js -assert(inventory === 'stick'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-008.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-008.md deleted file mode 100644 index 7a4a0040ab..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-008.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -id: 5d5aad2307f328a948d398d4 -title: Part 8 -challengeType: 0 -dashedName: part-8 ---- - -# --description-- - -Since the inventory can store multiple items, change the value of `inventory` to an array with the items stick, dagger, and sword. - -Here is an example of a variable sandwich that equals a three-item array: - -```js -let sandwich = ["peanut butter", "jelly", "bread"]; -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - inventory.includes('stick') && - inventory.includes('dagger') && - inventory.includes('sword') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-009.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-009.md deleted file mode 100644 index 95c7682998..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-009.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -id: 5d5aae1207f328a948d398d5 -title: Part 9 -challengeType: 0 -dashedName: part-9 ---- - -# --description-- - -For now, let's start the player with just the stick. Delete the dagger and sword items in the array. More items will be added to the array during game play. - -# --hints-- - -See description above for instructions. - -```js -assert(inventory[0] === 'stick' && inventory.length === 1); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-010.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-010.md deleted file mode 100644 index fe8783aa45..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-010.md +++ /dev/null @@ -1,131 +0,0 @@ ---- -id: 5d5ab57f07f328a948d398d6 -title: Part 10 -challengeType: 0 -dashedName: part-10 ---- - -# --description-- - -In order to update HTML elements on the page, you need to get references to them in your JavaScript code. The code `let el = document.querySelector("#el");` gets a reference to an HTML element with an `id` of `el` and assigns it to the variable `el`. - -Get a reference to the HTML element with the `id` of `button1` and assign it to a variable with the name `button1`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /let\s+button1\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#button1\s*[\'\"\`]\s*\);?/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-011.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-011.md deleted file mode 100644 index 33b03c9c92..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-011.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -id: 5d5b66ce07f328a948d398d7 -title: Part 11 -challengeType: 0 -dashedName: part-11 ---- - -# --description-- - -You can also declare variables with the `const` key word. Since `button1` is a constant that will never change, switch the `let` keyword that declares the variable to `const`. - -# --hints-- - -See description above for instructions. - -```js -assert(/const\s+button1\s*/.test(code)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-012.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-012.md deleted file mode 100644 index 9f6aba13f8..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-012.md +++ /dev/null @@ -1,165 +0,0 @@ ---- -id: 5d64cf8f853b56a21cd16319 -title: Part 12 -challengeType: 0 -dashedName: part-12 ---- - -# --description-- - -Here are the ids of the other HTML elements that we want a reference to in the JavaScript code: `button2`, `button3`, `text`, `xpText`, `healthText`, `goldText`, `monsterStats`, `monsterNameText`, `monsterHealthText`. - -Just like you did with `storeButton`, create variables and set them equal to the element references. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s+button2\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#button2\s*[\'\"\`]\s*\);?/.test( - code - ) && - /const\s+button3\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#button3\s*[\'\"\`]\s*\);?/.test( - code - ) && - /const\s+text\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#text\s*[\'\"\`]\s*\);?/.test( - code - ) && - /const\s+xpText\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#xpText\s*[\'\"\`]\s*\);?/.test( - code - ) && - /const\s+healthText\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#healthText\s*[\'\"\`]\s*\);?/.test( - code - ) && - /const\s+goldText\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#goldText\s*[\'\"\`]\s*\);?/.test( - code - ) && - /const\s+monsterStats\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#monsterStats\s*[\'\"\`]\s*\);?/.test( - code - ) && - /const\s+monsterNameText|monsterName\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#monsterName\s*[\'\"\`]\s*\);?/.test( - code - ) && - /const\s+monsterHealthText|monsterHealth\s*\=\s*document.querySelector\(\s*[\'\"\`]\s*\#monsterHealth\s*[\'\"\`]\s*\);?/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-013.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-013.md deleted file mode 100644 index fa6cc172bd..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-013.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -id: 5d651ee1ee291f75bbd738ee -title: Part 13 -challengeType: 0 -dashedName: part-13 ---- - -# --description-- - -Make a comment to describe what the next few lines of code will do. Comments can be written with either two forward-slashes `//` or with a multi-line sequence `/* */`. For example, here is a single line comment that says "hello world": `// hello world`. - -Write a single line comment that says "initialize buttons". - -# --hints-- - -See description above for instructions. - -```js -assert(/\/\/\s*[iI]nitialize buttons/.test(code)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-014.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-014.md deleted file mode 100644 index 5e5a71ca5c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-014.md +++ /dev/null @@ -1,150 +0,0 @@ ---- -id: 5d652e5a6e6bf7a6a27aa80a -title: Part 14 -challengeType: 0 -dashedName: part-14 ---- - -# --description-- - -Designate what the first button in the HTML does by setting the `onclick` property of `button1` to the function name `goStore`. You will create the `goStore` function later. For example, in `button.onclick = openProgram;`, the `onclick` property of `button` is set to `openProgram`. - -# --hints-- - -See description above for instructions. - -```js -assert(/button1\.onclick\s*\=\s*goStore\;?/.test(code)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-015.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-015.md deleted file mode 100644 index ef4c717e72..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-015.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -id: 5d653b2d6e6bf7a6a27aa80b -title: Part 15 -challengeType: 0 -dashedName: part-15 ---- - -# --description-- - -Now set the `onclick` property of `button2` and `button3`. The second button should be set to `goCave` and the third button should be set to `fightDragon`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /button2\.onclick\s*\=\s*goCave\;?/.test(code) && - /button3\.onclick\s*\=\s*fightDragon\;?/.test(code) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-016.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-016.md deleted file mode 100644 index a3b657d461..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-016.md +++ /dev/null @@ -1,162 +0,0 @@ ---- -id: 5d653c4d6e6bf7a6a27aa80c -title: Part 16 -challengeType: 0 -dashedName: part-16 ---- - -# --description-- - -Create the `goStore` function to hold the code that runs whenever the player goes to the store. Here is an example of an empty function called `functionName` (Note the opening curly brace at the end of the first line and the closing curly brace on the second line): - -```js -function functionName() { -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert(typeof goStore === 'function'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-017.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-017.md deleted file mode 100644 index d5b5e39ed6..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-017.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -id: 5d6542826e6bf7a6a27aa80d -title: Part 17 -challengeType: 0 -dashedName: part-17 ---- - -# --description-- - -For now, make the `goStore` function output the message "Going to store." to the web console. For example, here is a function that outputs the message "Hello World" to the web console (Note that code inside a function should be indented): - -```js -function functionName() { - console.log("Hello World"); -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - goStore - .toString() - .match(/console\.log\(\s*[\"\'\`]Going to store\.?[\"\'\`]\s*\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-018.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-018.md deleted file mode 100644 index a889d272bc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-018.md +++ /dev/null @@ -1,170 +0,0 @@ ---- -id: 5d65f2c62012114c7d7c57eb -title: Part 18 -challengeType: 0 -dashedName: part-18 ---- - -# --description-- - -Similar to the `goStore` function, create a `goCave` function that prints "Going to cave." to the console. - -# --hints-- - -See description above for instructions. - -```js -assert( - goCave - .toString() - .match(/console\.log\(\s*[\"\'\`]Going to cave\.?[\"\'\`]\s*\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-019.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-019.md deleted file mode 100644 index 57ab5c69cb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-019.md +++ /dev/null @@ -1,180 +0,0 @@ ---- -id: 5d65f4cd2012114c7d7c57ec -title: Part 19 -challengeType: 0 -dashedName: part-19 ---- - -# --description-- - -Also, create a `fightDragon` function that prints "Fighting dragon." to the console. - -When you are finished, you can test out your program in the browser. - -# --hints-- - -See description above for instructions. - -```js -assert( - fightDragon - .toString() - .match(/console\.log\(\s*[\"\'\`]Fighting dragon\.?[\"\'\`]\s*\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-020.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-020.md deleted file mode 100644 index ad137d4786..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-020.md +++ /dev/null @@ -1,185 +0,0 @@ ---- -id: 5d65f6392012114c7d7c57ed -title: Part 20 -challengeType: 0 -dashedName: part-20 ---- - -# --description-- - -When a player clicks the 'Go to store' button, the buttons and text in the game should change. Remove the code inside the `goStore` function. Add a new line of code inside the function that updates the text of `button1` so that it says "Buy 10 health (10 gold)". - -For example, this code updates the text of `button` to say "Click Me": `button.innerText = "Click Me";`. - -# --hints-- - -See description above for instructions. - -```js -assert( - (() => { - goStore(); - return button1.innerText === 'Buy 10 health (10 gold)'; - })() -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-021.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-021.md deleted file mode 100644 index a2672d2934..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-021.md +++ /dev/null @@ -1,189 +0,0 @@ ---- -id: 5d6606634bab337fbb433884 -title: Part 21 -challengeType: 0 -dashedName: part-21 ---- - -# --description-- - -After the line that updates `button1`, update the text of `button2` to say "Buy weapon (30 gold)" and update the text of `button3` to say "Go to town square". - -# --hints-- - -See description above for instructions. - -```js -assert( - (() => { - goStore(); - return ( - button1.innerText === 'Buy 10 health (10 gold)' && - button2.innerText === 'Buy weapon (30 gold)' && - button3.innerText === 'Go to town square' - ); - })() -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-022.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-022.md deleted file mode 100644 index 6fd39fc853..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-022.md +++ /dev/null @@ -1,189 +0,0 @@ ---- -id: 5d66093c4bab337fbb433885 -title: Part 22 -challengeType: 0 -dashedName: part-22 ---- - -# --description-- - -Now that the text on the buttons have changed, the `onclick` properties on the buttons should change. Inside the goStore function, update the `onclick` property of all three buttons. The new functions should be `buyHealth`, `buyWeapon`, and `goTown`. If you have trouble, look at how the buttons were initialized. - -# --hints-- - -See description above for instructions. - -```js -assert( - goStore.toString().match(/button1\.onclick\s*\=\s*buyHealth\;?/) && - goStore.toString().match(/button2\.onclick\s*\=\s*buyWeapon\;?/) && - goStore.toString().match(/button3\.onclick\s*\=\s*goTown\;?/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-023.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-023.md deleted file mode 100644 index 4a6293348b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-023.md +++ /dev/null @@ -1,193 +0,0 @@ ---- -id: 5d660a32e0696bdec46938d5 -title: Part 23 -challengeType: 0 -dashedName: part-23 ---- - -# --description-- - -Right after the `onclick` properties are updated, change the `innerText` property of `text` to "You enter the store." - -# --hints-- - -See description above for instructions. - -```js -assert( - goStore - .toString() - .match(/text\.innerText\s*\=\s*[\'\"\`]You enter the store\.?[\'\"\`]/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-024.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-024.md deleted file mode 100644 index abdd465afc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-024.md +++ /dev/null @@ -1,203 +0,0 @@ ---- -id: 5d6616d8e0696bdec46938d6 -title: Part 24 -challengeType: 0 -dashedName: part-24 ---- - -# --description-- - -At the end of the current code, add three new empty functions called `buyHealth`, `buyWeapon`, and `goTown`. After this step, you can test out the game by clicking the "Go to store" button. - -# --hints-- - -See description above for instructions. - -```js -assert( - typeof buyHealth === 'function' && - typeof buyWeapon === 'function' && - typeof goTown === 'function' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-025.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-025.md deleted file mode 100644 index a0a3a5a021..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-025.md +++ /dev/null @@ -1,228 +0,0 @@ ---- -id: 5d661814e0696bdec46938d7 -title: Part 25 -challengeType: 0 -dashedName: part-25 ---- - -# --description-- - -Move the `goTown` function to above the `goStore` function. Then, copy and paste the contents of the `goStore` function into the `goTown` function. - -# --hints-- - -See description above for instructions. - -```js -assert( - (() => { - goTown(); - return ( - button1.innerText === 'Buy 10 health (10 gold)' && - button2.innerText === 'Buy weapon (30 gold)' && - button3.innerText === 'Go to town square' && - text.innerText === 'You enter the store.' && - goTown.toString().match(/button1\.onclick\s*\=\s*buyHealth\;?/) && - goTown.toString().match(/button2\.onclick\s*\=\s*buyWeapon\;?/) && - goTown.toString().match(/button3\.onclick\s*\=\s*goTown\;?/) - ); - })() -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-026.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-026.md deleted file mode 100644 index ee955fc993..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-026.md +++ /dev/null @@ -1,230 +0,0 @@ ---- -id: 5d66198de0696bdec46938d8 -title: Part 26 -challengeType: 0 -dashedName: part-26 ---- - -# --description-- - -Add double quote marks around the word "Store" in the line "You see a sign that says Store." Before each quotation mark add a `\` to signal that the following quote is not the end of the string, but should instead appear inside the string. This is called escaping. - -# --hints-- - -See description above for instructions. - -```js -assert( - (() => { - goTown(); - return ( - text.innerText === - 'You are in the town square. You see a sign that says "Store".' - ); - })() -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-027.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-027.md deleted file mode 100644 index adfd7d0a56..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-027.md +++ /dev/null @@ -1,235 +0,0 @@ ---- -id: 5d661bc6e0696bdec46938d9 -title: Part 27 -challengeType: 0 -dashedName: part-27 ---- - -# --description-- - -There is repetition in the `goTown` and `goStore` functions. When you have repetition in code, it is a sign that you need a new function. - -Above the `goTown` function, create an empty function called `update`. This time the function should take a parameter named `location` so data can be passed into the function when it is called. - -Here is an example of a function named `testFun` that accepts a parameter named `param`: - -```js -function testFun(param) { - console.log(param); -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert(update.toString().match(/function update\(\s*location\)\s*\{\s*\}/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-028.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-028.md deleted file mode 100644 index ba513bd6d1..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-028.md +++ /dev/null @@ -1,230 +0,0 @@ ---- -id: 5d6653d5e0696bdec46938da -title: Part 28 -challengeType: 0 -dashedName: part-28 ---- - -# --description-- - -Below the list of `const` variables, create a new `const` variable called `locations`. Set it to equal an empty array. This will be used to store all the data for the locations in the game. - -# --hints-- - -See description above for instructions. - -```js -assert(Array.isArray(locations) && locations.length === 0); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-029.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-029.md deleted file mode 100644 index 6944af320f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-029.md +++ /dev/null @@ -1,236 +0,0 @@ ---- -id: 5d665983e0696bdec46938dc -title: Part 29 -challengeType: 0 -dashedName: part-29 ---- - -# --description-- - -Arrays can store any data type, including objects. Objects are similar to arrays, except that instead of using indexes to access and modify their data, you access the data in objects through what are called properties. - -Inside the `locations` array add an empty object using curly braces. - -Here is an example of an array named `arr` with an empty object inside: `const arr = [{}];` - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(JSON.stringify(locations), `[{}]`); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-030.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-030.md deleted file mode 100644 index f9c6d55fd8..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-030.md +++ /dev/null @@ -1,246 +0,0 @@ ---- -id: 5d674fd9e0696bdec46938dd -title: Part 30 -challengeType: 0 -dashedName: part-30 ---- - -# --description-- - -Inside the object you just added, create a property called `name` with the value of "town square". - -For example, here is an example of an array with an object inside that has a property called `name` with a value of "Quincy Larson" (new lines are used only for the purpose of making the code more readable): - -```js -const arr = [ - { - name: "Quincy Larson" - } -] -``` - -# --hints-- - -See description above for instructions. - -```js -assert(locations[0].name === 'town square'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-031.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-031.md deleted file mode 100644 index ac1796c49b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-031.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -id: 5d6752e3e0696bdec46938de -title: Part 31 -challengeType: 0 -dashedName: part-31 ---- - -# --description-- - -After the `name` property put a comma. On the next line add a property named `"button text"` that has a value of an empty array. Since the property name has more than one word, there must be quotes around it. - -Here is an example: - -```js -const arr = [ - { - name: "Quincy Larson", - "favorite colors": [] - } -] -``` - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[0]['button text'], []); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-032.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-032.md deleted file mode 100644 index d358864c5f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-032.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -id: 5d6755fce0696bdec46938df -title: Part 32 -challengeType: 0 -dashedName: part-32 ---- - -# --description-- - -Inside the `"button text"` array, add three string elements. Use the three stings assigned to the buttons inside the `goTown` function. - -Here is an example array with three strings: `const arr = ["one", "two", "three"];`. - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[0]['button text'], [ - 'Go to store', - 'Go to cave', - 'Fight dragon' -]); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-033.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-033.md deleted file mode 100644 index 7604f0b7a9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-033.md +++ /dev/null @@ -1,247 +0,0 @@ ---- -id: 5d675726e0696bdec46938e0 -title: Part 33 -challengeType: 0 -dashedName: part-33 ---- - -# --description-- - -Add another property in the object with the name `"button functions"`. The value should be an array containing the three `onclick` functions from the `goTown` function. It should look like this: `[goStore, goCave, fightDragon]` - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[0]['button functions'], [ - goStore, - goCave, - fightDragon -]); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-034.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-034.md deleted file mode 100644 index 53e94ec05c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-034.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -id: 5d678366e0696bdec46938e1 -title: Part 34 -challengeType: 0 -dashedName: part-34 ---- - -# --description-- - -Add one final property to the object named `text`. The value should be the final text from the `goTown` function. - -# --hints-- - -See description above for instructions. - -```js -assert( - locations[0].text === - 'You are in the town square. You see a sign that says "Store."' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-035.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-035.md deleted file mode 100644 index 6e9549b0e8..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-035.md +++ /dev/null @@ -1,261 +0,0 @@ ---- -id: 5d67845ee0696bdec46938e2 -title: Part 35 -challengeType: 0 -dashedName: part-35 ---- - -# --description-- - -The `locations` array currently has one element which is an object. Within the array, and after the object's final curly brace, add a comma. On the next line within the array, add another object with all the same properties as the first object. Keep the property names the same on the second object, but change all the property values to the information from the `goStore` function. Also, set the `name` property to `store`. - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[1], { - name: 'store', - 'button text': [ - 'Buy 10 health (10 gold)', - 'Buy weapon (30 gold)', - 'Go to town square' - ], - 'button functions': [buyHealth, buyWeapon, goTown], - text: 'You enter the store.' -}); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-036.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-036.md deleted file mode 100644 index 76823a417f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-036.md +++ /dev/null @@ -1,267 +0,0 @@ ---- -id: 5d67880ee0696bdec46938e3 -title: Part 36 -challengeType: 0 -dashedName: part-36 ---- - -# --description-- - -Now we are can consolidate the code inside the `goTown` and `goStore` functions. Copy the code inside the `goTown` function and paste it in the `update` function. Then delete all the code inside the `goTown` and `goStore` functions. - -# --hints-- - -See description above for instructions. - -```js -assert( - (() => { - update(); - return ( - goTown.toString() === 'function goTown() {}' && - goStore.toString() === 'function goStore() {}' && - button1.innerText === 'Go to store' && - button2.innerText === 'Go to cave' && - button3.innerText === 'Fight dragon' && - text.innerText === - 'You are in the town square. You see a sign that says "Store".' && - update.toString().match(/button1\.onclick\s*\=\s*goStore\;?/) && - update.toString().match(/button2\.onclick\s*\=\s*goCave\;?/) && - update.toString().match(/button3\.onclick\s*\=\s*fightDragon\;?/) - ); - })() -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-037.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-037.md deleted file mode 100644 index 996d05d8b2..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-037.md +++ /dev/null @@ -1,247 +0,0 @@ ---- -id: 5d67ad3de0696bdec46938e4 -title: Part 37 -challengeType: 0 -dashedName: part-37 ---- - -# --description-- - -Instead of assigning the `innerText` and `onClick` properties to specific strings and functions like it does now, the `update` function will use data from the `location` that is passed into it. First, data needs to be passed into the `update` function. Inside the `goTown` function, call the `update` function. - -Here is how you would call a function named `exampleFunction`: `exampleFunction();` - -# --hints-- - -See description above for instructions. - -```js -assert(goTown.toString().match(/update\(\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-038.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-038.md deleted file mode 100644 index 8b8100d9c3..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-038.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -id: 5d67ae95e0696bdec46938e5 -title: Part 38 -challengeType: 0 -dashedName: part-38 ---- - -# --description-- - -Now change the code you just wrote to call the `update` function so the `locations` array is passed in as an argument. - -Here is how you would call a function named `exampleFunction` with an argument called `arg`: `exampleFunction(arg);` - -# --hints-- - -See description above for instructions. - -```js -assert(goTown.toString().match(/update\(locations\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-039.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-039.md deleted file mode 100644 index 63f30c6b59..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-039.md +++ /dev/null @@ -1,246 +0,0 @@ ---- -id: 5d67b284e0696bdec46938e6 -title: Part 39 -challengeType: 0 -dashedName: part-39 ---- - -# --description-- - -The `locations` array contains two locations: the town square and store. Currently the entire array with both locations is being passed in to the update function. Pass in only the first element of the locations array by adding `[0]` at the end of the name of the array. For example, `exampleFunction(arg[0]);` - -# --hints-- - -See description above for instructions. - -```js -assert(goTown.toString().match(/update\(locations\[0\]\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-040.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-040.md deleted file mode 100644 index c8e8a9857d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-040.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -id: 5d67b945e0696bdec46938e7 -title: Part 40 -challengeType: 0 -dashedName: part-40 ---- - -# --description-- - -Now that the `goTown` function calls the `update` function with the first element of the `locations` array, it is time to use that location information to update the `innerText` and `onclick` properties. - -Inside the `update` function, change `button1.innerText` to equal `location["button text"]`. That line gets the `"button text"` property of the `location` that was passed into the `update` function\`. - -# --hints-- - -See description above for instructions. - -```js -assert( - update - .toString() - .match(/button1\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-041.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-041.md deleted file mode 100644 index bba6e8fafc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-041.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -id: 5d68c3b1e0696bdec46938e8 -title: Part 41 -challengeType: 0 -dashedName: part-41 ---- - -# --description-- - -`location["button text"]` is an array with three elements. Use only the first element of the array by adding `[0]` at the end. - -# --hints-- - -See description above for instructions. - -```js -assert( - update - .toString() - .match( - /button1\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]\[0\]/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-042.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-042.md deleted file mode 100644 index 5c6517b2b6..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-042.md +++ /dev/null @@ -1,257 +0,0 @@ ---- -id: 5d68c51ee0696bdec46938e9 -title: Part 42 -challengeType: 0 -dashedName: part-42 ---- - -# --description-- - -Now update the `innerText` of the other two buttons. They should be set to equal the same thing as the first button, except the number inside the brackets should be 1 for the second button and 2 for the third button. - -# --hints-- - -See description above for instructions. - -```js -assert( - update - .toString() - .match( - /button2\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]\[1\]/ - ) && - update - .toString() - .match( - /button3\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]\[2\]/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-043.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-043.md deleted file mode 100644 index 009d874188..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-043.md +++ /dev/null @@ -1,262 +0,0 @@ ---- -id: 5d68c5efe0696bdec46938ea -title: Part 43 -challengeType: 0 -dashedName: part-43 ---- - -# --description-- - -Now update the three `onclick` properties. These will look very similar to the `innerText` properties, except instead of using the `"button text"` part of the `location`, use `"button functions"`. - -# --hints-- - -See description above for instructions. - -```js -assert( - update - .toString() - .match( - /button1\.onclick\s*\=\s*location\[[\'\"\`]button functions[\'\"\`]\]\[0\]/ - ) && - update - .toString() - .match( - /button2\.onclick\s*\=\s*location\[[\'\"\`]button functions[\'\"\`]\]\[1\]/ - ) && - update - .toString() - .match( - /button3\.onclick\s*\=\s*location\[[\'\"\`]button functions[\'\"\`]\]\[2\]/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-044.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-044.md deleted file mode 100644 index 491a31d4c1..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-044.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -id: 5d68c758e0696bdec46938eb -title: Part 44 -challengeType: 0 -dashedName: part-44 ---- - -# --description-- - -Finally, update `text.innerText` to equal the `text` from the location object. - -So far we have been accessing properties of the location object using bracket notation. This time use dot notation. Here is how to access a `name` property of an object called `obj` using dot notation: `obj.name`. - -# --hints-- - -See description above for instructions. - -```js -assert(update.toString().match(/text\.innerText\s*\=\s*location\.text\;?/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-045.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-045.md deleted file mode 100644 index cfcc6110ac..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-045.md +++ /dev/null @@ -1,247 +0,0 @@ ---- -id: 5d68c947e0696bdec46938ec -title: Part 45 -challengeType: 0 -dashedName: part-45 ---- - -# --description-- - -Now update the `goStore` function. The code should look just like the code inside the `goTown` function, except the number 0 should be changed to 1. After this step would be a good time to try out the game so far. You should be able to move between the store and the town square. - -# --hints-- - -See description above for instructions. - -```js -assert(goStore.toString().match(/update\(locations\[1\]\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-046.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-046.md deleted file mode 100644 index 8880e9dbae..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-046.md +++ /dev/null @@ -1,266 +0,0 @@ ---- -id: 5d68ca40e0696bdec46938ed -title: Part 46 -challengeType: 0 -dashedName: part-46 ---- - -# --description-- - -Add a third object in the `locations` array with the same properties as the other two objects. - -Set `name` to "cave". Set the elements in the `"button text"` array to \["Fight slime", "Fight fanged beast", and "Go to town square". Set te elements in the `"button functions"` array to be "fightSlime", "fightBeast", and "goTown". Set the value of the `text` property to "You enter the cave. You see some monsters.". - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[2], { - name: 'cave', - 'button text': ['Fight slime', 'Fight fanged beast', 'Go to town square'], - 'button functions': [fightSlime, fightBeast, goTown], - text: 'You enter the cave. You see some monsters.' -}); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
- -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-047.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-047.md deleted file mode 100644 index f80a1a077e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-047.md +++ /dev/null @@ -1,265 +0,0 @@ ---- -id: 5d68d3f7e0696bdec46938ee -title: Part 47 -challengeType: 0 -dashedName: part-47 ---- - -# --description-- - -Now update the `goCave` function using the pattern from `goTown` and `goCave`. - -# --hints-- - -See description above for instructions. - -```js -assert(goCave.toString().match(/update\(locations\[2\]\)\;?/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
- -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-048.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-048.md deleted file mode 100644 index fe48b13995..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-048.md +++ /dev/null @@ -1,266 +0,0 @@ ---- -id: 5d68d4fde0696bdec46938ef -title: Part 48 -challengeType: 0 -dashedName: part-48 ---- - -# --description-- - -Create two more empty functions: `fightSlime` and `fightBeast`. - -# --hints-- - -See description above for instructions. - -```js -assert(typeof fightSlime === 'function' && typeof fightBeast === 'function'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-049.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-049.md deleted file mode 100644 index ff7dfebe58..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-049.md +++ /dev/null @@ -1,275 +0,0 @@ ---- -id: 5d68d631e0696bdec46938f0 -title: Part 49 -challengeType: 0 -dashedName: part-49 ---- - -# --description-- - -Now that the store and cave locations are complete, we'll code the actions at those locations. Inside the `buyHealth` function, set `gold` to equal `gold` minus 10. - -For example here is how you would set set `num` to equal 5 less than `num`: `num = num - 5;`. - -# --hints-- - -See description above for instructions. - -```js -buyHealth(), assert(gold === 40); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-050.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-050.md deleted file mode 100644 index d933dc407a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-050.md +++ /dev/null @@ -1,275 +0,0 @@ ---- -id: 5d68dbf7e0696bdec46938f1 -title: Part 50 -challengeType: 0 -dashedName: part-50 ---- - -# --description-- - -After gold is subtracted, add ten to health. - -# --hints-- - -See description above for instructions. - -```js -buyHealth(), assert(gold === 40 && health === 110); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-051.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-051.md deleted file mode 100644 index 5fcb7a9139..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-051.md +++ /dev/null @@ -1,281 +0,0 @@ ---- -id: 5d6904b6e0696bdec46938f2 -title: Part 51 -challengeType: 0 -dashedName: part-51 ---- - -# --description-- - -There is a shorthand way to add or subtract from a variable called compound assignment. The long way to add to a variable is `num = num + 5`. The shorthand way is `num += 5`. It works the same way with subtraction. - -Update both lines inside the `buyHealth` function to use compound assignment. - -# --hints-- - -See description above for instructions. - -```js -assert( - buyHealth.toString().match(/gold\s*\-\=\s*10\;?/) && - buyHealth.toString().match(/health\s*\+\=\s*10\;?/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-052.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-052.md deleted file mode 100644 index ea3cf82bfa..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-052.md +++ /dev/null @@ -1,281 +0,0 @@ ---- -id: 5d6905ace0696bdec46938f3 -title: Part 52 -challengeType: 0 -dashedName: part-52 ---- - -# --description-- - -Now that the gold and health variables have been updated, we need to update the values displayed on the screen. Inside the `buyHealth` function, add the line `goldText.innerText = gold;`. Then use the same pattern to update `healthText`. - -# --hints-- - -See description above for instructions. - -```js -assert( - buyHealth.toString().match(/goldText\.innerText\s*\=\s*gold\;?/) && - buyHealth.toString().match(/healthText.innerText\s*\=\s*health\;?/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-053.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-053.md deleted file mode 100644 index b9488436a8..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-053.md +++ /dev/null @@ -1,302 +0,0 @@ ---- -id: 5d6f6bfc7c812010bf3327cc -title: Part 53 -challengeType: 0 -dashedName: part-53 ---- - -# --description-- - -What if the player doesn't have enough gold to buy health? Put all the code in the `buyHealth` function inside an `if` statement. Here is an example of an `if` statement inside a function: - -```js -function checkMoney() { - if (condition) { - console.log("You have money!"); - } -} -``` - -Note: For now you should use the word "condition" inside the `if` statement but we'll be changing that next. - -# --hints-- - -See description above for instructions. - -```js -assert( - buyHealth - .toString() - .match( - /if\s*\(\s*condition\s*\)\s*\{\s*(gold|health|goldText|healthText)/ - ) && - buyHealth.toString().match(/gold\s*\-\=\s*10\;?/) && - buyHealth.toString().match(/health\s*\+\=\s*10\;?/) && - buyHealth.toString().match(/goldText\.innerText\s*\=\s*gold\;?/) && - buyHealth.toString().match(/healthText\.innerText\s*\=\s*health\;?/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-054.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-054.md deleted file mode 100644 index e28f8fba0a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-054.md +++ /dev/null @@ -1,292 +0,0 @@ ---- -id: 5d6f6e3c7c812010bf3327cd -title: Part 54 -challengeType: 0 -dashedName: part-54 ---- - -# --description-- - -The word "condition" inside the if statement is just a placeholder. Change the condition to check if the amount of gold the player has is greater than or equal to 10. - -Here is an `if` statement that checks if `num` is greater than or equal to 5: - -```js -if (num >= 5) { - console.log("Num is greater than or equal to five!"); -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert(buyHealth.toString().match(/if\s*\(\s*gold\s*\>\=\s*10\s*\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-055.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-055.md deleted file mode 100644 index 1961a7c3bd..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-055.md +++ /dev/null @@ -1,295 +0,0 @@ ---- -id: 5d6f6f747c812010bf3327ce -title: Part 55 -challengeType: 0 -dashedName: part-55 ---- - -# --description-- - -Now when a player tries to buy health it will only work if they have enough money. If the player does not have enough money, nothing will happen. Add an `else` statement where you can put code to run if a player dees not have enough money. - -Here is an example of an empty `else` statement: - -```js -if (num >= 5) { - console.log("Num is greater than or equal to five!"); -} else { -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert(buyHealth.toString().match(/\}\s*else\s*\{\s*\}/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-056.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-056.md deleted file mode 100644 index 92734d76b2..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-056.md +++ /dev/null @@ -1,290 +0,0 @@ ---- -id: 5d6f70937c812010bf3327cf -title: Part 56 -challengeType: 0 -dashedName: part-56 ---- - -# --description-- - -Inside the `else` statement, set `text.innerText` to equal "You do not have enough gold to buy health." - -# --hints-- - -See description above for instructions. - -```js -(gold = 5), - buyHealth(), - assert(text.innerText === 'You do not have enough gold to buy health.'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-057.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-057.md deleted file mode 100644 index c125391b4d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-057.md +++ /dev/null @@ -1,290 +0,0 @@ ---- -id: 5d6f72657c812010bf3327d0 -title: Part 57 -challengeType: 0 -dashedName: part-57 ---- - -# --description-- - -Before we write the code for the `buyWeapon` function, use `const` to create a `weapons` variable right above the `locations` array. Set it to equal an empty array. - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(weapons, []); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-058.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-058.md deleted file mode 100644 index d48d9e790d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-058.md +++ /dev/null @@ -1,314 +0,0 @@ ---- -id: 5d6f736b7c812010bf3327d2 -title: Part 58 -challengeType: 0 -dashedName: part-58 ---- - -# --description-- - -Just like in the `locations` array, all the elements in `weapons` will be objects. Add four objects to the `weapons` array, each with two properties: `name` and `power`. The first should be the `name` "stick" with `power` set to 5. Then, "dagger" with set `power` to 30. Next, "claw hammer" with a `power` of 50. Finally, "sword" with a `power` of 100. - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(weapons, [ - { name: 'stick', power: 5 }, - { name: 'dagger', power: 30 }, - { name: 'claw hammer', power: 50 }, - { name: 'sword', power: 100 } -]); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-059.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-059.md deleted file mode 100644 index f24a62ffa5..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-059.md +++ /dev/null @@ -1,329 +0,0 @@ ---- -id: 5d6f776c7c812010bf3327d3 -title: Part 59 -challengeType: 0 -dashedName: part-59 ---- - -# --description-- - -Inside the `buyWeapon` function, add an `if` statement to check if gold is greater than or equal to 30. - -# --hints-- - -See description above for instructions. - -```js -assert(buyWeapon.toString().match(/if\s*\(\s*gold\s*\>\=\s*30\)\s*\{\s*\}/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-060.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-060.md deleted file mode 100644 index a868276b9a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-060.md +++ /dev/null @@ -1,332 +0,0 @@ ---- -id: 5d6f785f7c812010bf3327d4 -title: Part 60 -challengeType: 0 -dashedName: part-60 ---- - -# --description-- - -Similar to in the `buyHealth` function, set `gold` to equal 30 less than its current value. - -# --hints-- - -See description above for instructions. - -```js -(gold = 50), buyWeapon(), assert(gold === 20); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-061.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-061.md deleted file mode 100644 index 5cee23ff5b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-061.md +++ /dev/null @@ -1,333 +0,0 @@ ---- -id: 5d6f79667c812010bf3327d6 -title: Part 61 -challengeType: 0 -dashedName: part-61 ---- - -# --description-- - -The value of `currentWeapon` 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. In the `buyWeapon` function, add one to `currentWeapon` since the user is buying the next weapon in the `weapons` array. - -# --hints-- - -See description above for instructions. - -```js -(currentWeapon = 0), buyWeapon(), assert(currentWeapon === 1); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-062.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-062.md deleted file mode 100644 index ee5a51bf97..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-062.md +++ /dev/null @@ -1,342 +0,0 @@ ---- -id: 5d6f7b917c812010bf3327d7 -title: Part 62 -challengeType: 0 -dashedName: part-62 ---- - -# --description-- - -You can easily increment or add one to a variable with the `++` operator. All three of these statements add one to a number: - -```js -num = num + 1; -num += 1; -num++; -``` - -Change the line `currentWeapon += 1;` to use the `++` operator. - -# --hints-- - -See description above for instructions. - -```js -assert(buyWeapon.toString().match(/currentWeapon\s*\+\+\;?/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-063.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-063.md deleted file mode 100644 index 26bf3f78dc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-063.md +++ /dev/null @@ -1,340 +0,0 @@ ---- -id: 5d6f82da7c812010bf3327d8 -title: Part 63 -challengeType: 0 -dashedName: part-63 ---- - -# --description-- - -Now update the `innerText` property of `goldText` and `text`. `text` should equal "You now have a new weapon.". - -# --hints-- - -See description above for instructions. - -```js -buyWeapon(), - assert( - goldText.innerText === '20' && - text.innerText === 'You now have a new weapon.' - ); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-064.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-064.md deleted file mode 100644 index 8725a9fc6e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-064.md +++ /dev/null @@ -1,339 +0,0 @@ ---- -id: 5d6f919f7c812010bf3327d9 -title: Part 64 -challengeType: 0 -dashedName: part-64 ---- - -# --description-- - -Let's tell the player what weapon they bought. In between the two lines you just wrote, use `let` to initialize a new variable called `newWeapon`. Set `newWeapon` to equal `weapons`. - -# --hints-- - -See description above for instructions. - -```js -assert(/let\s*newWeapon\s*\=\s*weapons\;?/.test(code)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-065.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-065.md deleted file mode 100644 index 32764ac06a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-065.md +++ /dev/null @@ -1,340 +0,0 @@ ---- -id: 5d6f94347c812010bf3327da -title: Part 65 -challengeType: 0 -dashedName: part-65 ---- - -# --description-- - -Right after the word `weapons` (with no space between), add brackets `[]`. In between the brackets put `currentWeapon`, which is the index number of the weapon the player just bought. - -# --hints-- - -See description above for instructions. - -```js -assert(/let\s*newWeapon\s*\=\s*weapons\s?\[currentWeapon\]\;?/.test(code)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-066.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-066.md deleted file mode 100644 index 597e6d7aad..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-066.md +++ /dev/null @@ -1,342 +0,0 @@ ---- -id: 5d6f96747c812010bf3327db -title: Part 66 -challengeType: 0 -dashedName: part-66 ---- - -# --description-- - -Get just the name property of the current weapon by adding `.name` at the end of `weapons[currentWeapon]` (don't use a space). - -# --hints-- - -See description above for instructions. - -```js -assert( - /let\s*newWeapon\s*\=\s*weapons\s?\[currentWeapon\]\.name\;?/.test(code) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-067.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-067.md deleted file mode 100644 index 5fd5f2e6f3..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-067.md +++ /dev/null @@ -1,351 +0,0 @@ ---- -id: 5d6f98247c812010bf3327dc -title: Part 67 -challengeType: 0 -dashedName: part-67 ---- - -# --description-- - -You can insert variables into a string with the concatenation (`+`) operator. Update the "You now have a new weapon." string so it says "You now have a " and then lists the name of the new weapon. Make sure to add a period at the end of the sentence. - -Here is an example that creates the string "Hello, our name is freeCodeCamp.": - -```js -let ourName = "freeCodeCamp"; -let ourStr = "Hello, our name is " + ourName + "."; -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - buyWeapon - .toString() - .match(/[\'\"\`]You now have a [\'\"\`]\s*\+\s*newWeapon\;?/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-068.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-068.md deleted file mode 100644 index 9bd5e014cd..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-068.md +++ /dev/null @@ -1,348 +0,0 @@ ---- -id: 5d6f9a4c7c812010bf3327dd -title: Part 68 -challengeType: 0 -dashedName: part-68 ---- - -# --description-- - -Way back at the beginning you created the `inventory` array. Push the `newWeapon` onto the end of the `inventory` array. Here is an example of pushing onto an array: - -```js -let arr = ["first"]; -let next = "second"; -arr.push(next); -// arr now equals ["first", "second"] -``` - -# --hints-- - -See description above for instructions. - -```js -buyWeapon(), assert.deepStrictEqual(inventory, ['stick', 'dagger']); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-069.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-069.md deleted file mode 100644 index ed7ac6e071..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-069.md +++ /dev/null @@ -1,349 +0,0 @@ ---- -id: 5d70850e066dac7142a6d797 -title: Part 69 -challengeType: 0 -dashedName: part-69 ---- - -# --description-- - -Up to this point, anytime `text.innerText` was updated, the old text was erased. This time, use the `+=` operator instead of the `=` operator to add text to the end of `text.innerText`. Add the string " In your inventory you have: " (include the spaces at the beginning and end). - -# --hints-- - -See description above for instructions. - -```js -assert( - buyWeapon - .toString() - .match( - /text\.innerText\s*\+\=\s*[\'\"\`] In your inventory you have\: [\'\"\`]\;?/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-070.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-070.md deleted file mode 100644 index 0e64dbaded..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-070.md +++ /dev/null @@ -1,350 +0,0 @@ ---- -id: 5d70862e066dac7142a6d798 -title: Part 70 -challengeType: 0 -dashedName: part-70 ---- - -# --description-- - -At the end of the string you just added after the ending quote mark, add `+ inventory` to add the contents of the inventory to the end of the string. - -# --hints-- - -See description above for instructions. - -```js -assert( - buyWeapon - .toString() - .match( - /text\.innerText\s*\+\=\s*[\'\"\`] In your inventory you have\: [\'\"\`]\s*\+\s*inventory\;?/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-071.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-071.md deleted file mode 100644 index b2dfd7e4c2..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-071.md +++ /dev/null @@ -1,352 +0,0 @@ ---- -id: 5d7086d4066dac7142a6d799 -title: Part 71 -challengeType: 0 -dashedName: part-71 ---- - -# --description-- - -At the end of the `if` statement inside the `buyWeapon` function, add an `else` statement. Inside the `else` statement, set `text.innerText` to equal "You do not have enough gold to buy a weapon.". - -# --hints-- - -See description above for instructions. - -```js -assert( - buyWeapon - .toString() - .match( - /\}\s*else\s*\{\s*text\.innerText\s*\=\s*[\'\"\`]You do not have enough gold to buy a weapon\.?[\'\"\`]\;?\s*\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-072.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-072.md deleted file mode 100644 index 6da16fae4d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-072.md +++ /dev/null @@ -1,361 +0,0 @@ ---- -id: 5d7088d2066dac7142a6d79a -title: Part 72 -challengeType: 0 -dashedName: part-72 ---- - -# --description-- - -Once a player has the best weapon, they can't buy another one. Wrap all the code in the `buyWeapon` function inside another `if` statement. The condition should check if `currentWeapon` is less than 3 (the index of the last weapon). - -# --hints-- - -See description above for instructions. - -```js -assert( - buyWeapon - .toString() - .match( - /if\s*\(\s*currentWeapon\s*\<\s*3\s*\)\s*\{\s*if\s*\(\s*gold\s*\>\=\s*30\s*\)\s*\{/ - ) && - buyWeapon - .toString() - .match( - /\}\s*else\s*\{\s*text\.innerText\s*\=\s*[\'\"\`]You do not have enough gold to buy a weapon\.?[\'\"\`]\;?\s*\}\s*\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-073.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-073.md deleted file mode 100644 index b2de94000c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-073.md +++ /dev/null @@ -1,358 +0,0 @@ ---- -id: 5d708ab5066dac7142a6d79b -title: Part 73 -challengeType: 0 -dashedName: part-73 ---- - -# --description-- - -At some point in the future, you may want to add more weapons. Instead of checking if `currentWeapon` is less than three, check if `currentWeapon` is less than the length of the `weapons` array. For example, here is how you would get the length of an array called `arr`: `arr.length`. - -# --hints-- - -See description above for instructions. - -```js -assert( - buyWeapon - .toString() - .match( - /if\s*\(\s*currentWeapon\s*\<\s*weapons\.length\s*\)\s*\{\s*if\s*\(\s*gold\s*\>\=\s*30\s*\)\s*\{/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-074.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-074.md deleted file mode 100644 index ac6f24dc33..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-074.md +++ /dev/null @@ -1,358 +0,0 @@ ---- -id: 5d708be9066dac7142a6d79c -title: Part 74 -challengeType: 0 -dashedName: part-74 ---- - -# --description-- - -We have to fix an error. The `currentWeapon` variable is the array index. Array indexing starts at zero. The index of the last element in an array is one less than the length of the array. In the `if` condition you are working on, change `weapons.length` to `weapons.length - 1`. - -# --hints-- - -See description above for instructions. - -```js -assert( - buyWeapon - .toString() - .match( - /if\s*\(\s*currentWeapon\s*\<\s*weapons\.length\s*\-\s*1\s*\)\s*\{\s*if\s*\(\s*gold\s*\>\=\s*30\s*\)\s*\{/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-075.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-075.md deleted file mode 100644 index d8745f0ce6..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-075.md +++ /dev/null @@ -1,360 +0,0 @@ ---- -id: 5d708c9a066dac7142a6d79d -title: Part 75 -challengeType: 0 -dashedName: part-75 ---- - -# --description-- - -Add an `else` statement on the end of the outer `if` statement. Inside the `else` statement, set `text.innerText` to "You already have the most powerful weapon!". - -# --hints-- - -See description above for instructions. - -```js -assert( - buyWeapon - .toString() - .match( - /\}\s*else\s*\{\s*text\.innerText\s*\=\s*[\'\"\`]You do not have enough gold to buy a weapon\.?[\'\"\`]\;?\s*\}\s*\}\s*else\s*\{\s*text\.innerText\s*\=\s*[\'\"\`]You already have the most powerful weapon\![\'\"\`]\;?\s*\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-076.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-076.md deleted file mode 100644 index 9c9369715d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-076.md +++ /dev/null @@ -1,364 +0,0 @@ ---- -id: 5d708dd7066dac7142a6d79e -title: Part 76 -challengeType: 0 -dashedName: part-76 ---- - -# --description-- - -Once a player has the most powerful weapon, we'll give them the ability to sell their older weapons back. In the else statement, set `button2.innerText` to equal "Sell weapon for 15 gold". Also, set `button2.onclick` to the function name `sellWeapon`. - -# --hints-- - -See description above for instructions. - -```js -assert( - buyWeapon - .toString() - .match( - /else\s*\{\s*text\.innerText\s*\=\s*[\'\"\`]You already have the most powerful weapon\![\'\"\`]\;?\s*button2\.innerText\s*\=\s*[\'\"\`]Sell weapon for 15 gold\.?[\'\"\`]\;?\s*button2\.onclick\s*\=\s*sellWeapon\;?\s*\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-077.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-077.md deleted file mode 100644 index 2204991a58..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-077.md +++ /dev/null @@ -1,363 +0,0 @@ ---- -id: 5d708fae066dac7142a6d79f -title: Part 77 -challengeType: 0 -dashedName: part-77 ---- - -# --description-- - -After the `buyWeapon` function, create an empty function called `sellWeapon`. - -# --hints-- - -See description above for instructions. - -```js -assert(typeof sellWeapon === 'function'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-078.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-078.md deleted file mode 100644 index cdb3492126..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-078.md +++ /dev/null @@ -1,373 +0,0 @@ ---- -id: 5d709664066dac7142a6d7a0 -title: Part 78 -challengeType: 0 -dashedName: part-78 ---- - -# --description-- - -Players should not be able to sell their only weapon. Inside the `sellWeapon` function, add an `if` statement with a condition that checks if the length of the `inventory` array is greater than one. - -# --hints-- - -See description above for instructions. - -```js -assert( - sellWeapon - .toString() - .match(/if\s*\(\s*inventory\.length\s*\>\s*1\s*\)\s*\{\s*\}/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-079.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-079.md deleted file mode 100644 index adf7474dbd..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-079.md +++ /dev/null @@ -1,386 +0,0 @@ ---- -id: 5d709bbc066dac7142a6d7a2 -title: Part 79 -challengeType: 0 -dashedName: part-79 ---- - -# --description-- - -Inside the `if` statement, set `gold` equal to 15 more than its current value. Also, update `goldText.innerText` to the new value. - -# --hints-- - -See description above for instructions. - -```js -assert( - (() => { - gold = 50; - inventory = ['stick']; - sellWeapon(); - return gold === 50 && goldText.innerText === '50'; - })() && - (() => { - gold = 50; - inventory = ['stick', 'dagger']; - sellWeapon(); - return gold === 65 && goldText.innerText === '65'; - })() -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-080.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-080.md deleted file mode 100644 index cc10b5e0ee..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-080.md +++ /dev/null @@ -1,379 +0,0 @@ ---- -id: 5d71b58b848f6914ab89897d -title: Part 80 -challengeType: 0 -dashedName: part-80 ---- - -# --description-- - -Use the `let` keyword to create a variable named `currentWeapon`. Don't set it equal to anything yet. Notice that we already have a `currentWeapon` variable from earlier. Since the `let` keyword is used instead of `var`, this new version of `currentWeapon` is scoped only to this `if` statement. At the close of the `if` statement, the old version of `currentWeapon` will be used again. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.match( - /if\s*\(\s*inventory\.length\s*\>\s*1\s*\)\s*\{\s*(.\s*)*let\s*currentWeapon\;?/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-081.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-081.md deleted file mode 100644 index 043a6e1b1e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-081.md +++ /dev/null @@ -1,388 +0,0 @@ ---- -id: 5d71bdca848f6914ab89897e -title: Part 81 -challengeType: 0 -dashedName: part-81 ---- - -# --description-- - -Use the `shift()` method on the `inventory` array to remove the first element and return that removed element. Set `currentWeapon` to equal returned element. - -Here is an example: - -```js -let arr = ["one", "two", "three"]; -let firstElement = arr.shift(); -// arr now equals ["two", "three"] and firstElement now equals "one" -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - code.match( - /if\s*\(\s*inventory\.length\s*\>\s*1\s*\)\s*\{\s*(.\s*)*let\s*currentWeapon\s*\=\s*inventory\.shift\(\s*\)\;?/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-082.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-082.md deleted file mode 100644 index 1c53103684..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-082.md +++ /dev/null @@ -1,380 +0,0 @@ ---- -id: 5d71bfdf848f6914ab89897f -title: Part 82 -challengeType: 0 -dashedName: part-82 ---- - -# --description-- - -After the line that creates the `currentWeapon` variable, set `text.innerText` to equal `"You sold a " + currentWeapon + "."` - -# --hints-- - -See description above for instructions. - -```js -(inventory = ['potato', 'carrot']), - sellWeapon(), - assert(text.innerText === 'You sold a potato.' && inventory[0] === 'carrot'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-083.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-083.md deleted file mode 100644 index 93d8b087fd..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-083.md +++ /dev/null @@ -1,384 +0,0 @@ ---- -id: 5d71c20f848f6914ab898980 -title: Part 83 -challengeType: 0 -dashedName: part-83 ---- - -# --description-- - -Now use the `+=` operator to add to `text.innerText`. Add the string " In your inventory you have: " (with spaces at the beginning and end). Then add the `inventory` variable to the end of the string. - -# --hints-- - -See description above for instructions. - -```js -(inventory = ['potato', 'carrot']), - sellWeapon(), - assert( - text.innerText === 'You sold a potato. In your inventory you have: carrot' - ); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-084.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-084.md deleted file mode 100644 index 3874c2eb17..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-084.md +++ /dev/null @@ -1,387 +0,0 @@ ---- -id: 5d71c80e848f6914ab898981 -title: Part 84 -challengeType: 0 -dashedName: part-84 ---- - -# --description-- - -Add code so that if the length of the inventory is NOT more than one, then a text message appears that says "Don't sell your only weapon!". - -# --hints-- - -See description above for instructions. - -```js -(inventory = ['potato']), - sellWeapon(), - assert( - inventory[0] === 'potato' && - text.innerText === "Don't sell your only weapon!" - ); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-085.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-085.md deleted file mode 100644 index 3bdde43e8f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-085.md +++ /dev/null @@ -1,408 +0,0 @@ ---- -id: 5d71cab4f27e5122af9f1178 -title: Part 85 -challengeType: 0 -dashedName: part-85 ---- - -# --description-- - -Now we'll start working on fighting monsters. Organize your code by moving the `fightDragon` function to the bottom of the code near the other fight functions. - -Below where the `weapons` array is defined, define a `monsters` array. Set the contents of the `monsters` array to: `{ name: "slime", level: 2, health: 15 }, {name: "fanged beast", level: 8, health: 60 }, { name: "dragon", level: 20, health: 300 }`. Space out the code similar to the `weapons` array so that it is easier to read. - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(monsters, [ - { name: 'slime', level: 2, health: 15 }, - { name: 'fanged beast', level: 8, health: 60 }, - { name: 'dragon', level: 20, health: 300 } -]); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-086.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-086.md deleted file mode 100644 index eb27db0455..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-086.md +++ /dev/null @@ -1,423 +0,0 @@ ---- -id: 5d71ea30f27e5122af9f1179 -title: Part 86 -challengeType: 0 -dashedName: part-86 ---- - -# --description-- - -Fighting each type of monster will be very similar so all three fighting functions will call a function named `goFight`. At the end of the code, add an empty function named `goFight`. - -# --hints-- - -See description above for instructions. - -```js -assert(typeof goFight === 'function'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-087.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-087.md deleted file mode 100644 index 181b645c76..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-087.md +++ /dev/null @@ -1,430 +0,0 @@ ---- -id: 5d71eb0bf27e5122af9f117a -title: Part 87 -challengeType: 0 -dashedName: part-87 ---- - -# --description-- - -Inside the `fightSlime` function, set `fighting` to equal 0 (which is the index of the slime in the `monsters` array). On the next line, call the `goFight` function. - -As a reminder, here is how you would call a function named `myFunc`: `myFunc();`. - -# --hints-- - -See description above for instructions. - -```js -assert(fightSlime.toString().match(/fighting\s*\=\s*0\;?\s*goFight\(\s*\)\;?/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-088.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-088.md deleted file mode 100644 index 052627f864..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-088.md +++ /dev/null @@ -1,436 +0,0 @@ ---- -id: 5d71f787e39bedcf8f0998ff -title: Part 88 -challengeType: 0 -dashedName: part-88 ---- - -# --description-- - -Write the code for the `fightBeast` and `fightDragon` functions, using the `fightSlime` function as an example. Make sure to delete the line that is already in the `fightDragon` function. - -# --hints-- - -See description above for instructions. - -```js -assert( - fightBeast.toString().match(/fighting\s*\=\s*1\;?\s*goFight\(\s*\)\;?/) && - fightDragon.toString().match(/fighting\s*\=\s*2\;?\s*goFight\(\s*\)\;?/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-089.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-089.md deleted file mode 100644 index 47c417e426..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-089.md +++ /dev/null @@ -1,452 +0,0 @@ ---- -id: 5d71ed88f27e5122af9f117b -title: Part 89 -challengeType: 0 -dashedName: part-89 ---- - -# --description-- - -Add a new object in the `locations` array with all the same properties as the other objects in the array. Set `name` to "fight". Set `"button text"` to `["Attack", "Dodge", "Run"]`. Set `"button functions"` to `[attack, dodge, goTown]`. And set `text` to "You are fighting a monster.". - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[3], { - name: 'fight', - 'button text': ['Attack', 'Dodge', 'Run'], - 'button functions': [attack, dodge, goTown], - text: 'You are fighting a monster.' -}); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
- -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-090.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-090.md deleted file mode 100644 index d84f61206f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-090.md +++ /dev/null @@ -1,454 +0,0 @@ ---- -id: 5d71f217e39bedcf8f0998fd -title: Part 90 -challengeType: 0 -dashedName: part-90 ---- - -# --description-- - -At the end of the code create empty functions named `attack` and `dodge`. - -# --hints-- - -See description above for instructions. - -```js -assert(typeof attack === 'function' && typeof dodge === 'function'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-091.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-091.md deleted file mode 100644 index 3dc950693b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-091.md +++ /dev/null @@ -1,461 +0,0 @@ ---- -id: 5d71f669e39bedcf8f0998fe -title: Part 91 -challengeType: 0 -dashedName: part-91 ---- - -# --description-- - -In the `goFight` function, call the `update` function and pass it `locations[3]`. - -# --hints-- - -See description above for instructions. - -```js -assert(goFight.toString().match(/update\(\s*locations\[\s*3\s*\]\s*\)\;?/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-092.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-092.md deleted file mode 100644 index f4a6a6eb3e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-092.md +++ /dev/null @@ -1,476 +0,0 @@ ---- -id: 5d72027ce39bedcf8f099900 -title: Part 92 -challengeType: 0 -dashedName: part-92 ---- - -# --description-- - -Next in the `goFight` function, set `monsterHealth` to equal the health of the current monster. You can get the health of the current monster with `monsters[fighting].health`. Try to understand that line before continuing. - -# --hints-- - -See description above for instructions. - -```js -assert( - (() => { - fightSlime(); - return monsterHealth === 15; - })() && - (() => { - fightBeast(); - return monsterHealth === 60; - })() && - (() => { - fightDragon(); - return monsterHealth === 300; - })() -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-093.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-093.md deleted file mode 100644 index 84e0290e3c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-093.md +++ /dev/null @@ -1,471 +0,0 @@ ---- -id: 5d721925e39bedcf8f099901 -title: Part 93 -challengeType: 0 -dashedName: part-93 ---- - -# --description-- - -The HTML that shows the monster stats that has been hidden using CSS. Display the `monsterStats` HTML element by updating its CSS `display` property to equal `block`. - -Here is an example of updating the `display` property of an element named `myElement`: `myElement.style.display = "block";` - -# --hints-- - -See description above for instructions. - -```js -assert( - goFight - .toString() - .match(/^\s*monsterStats\.style\.display\s*\=\s*[\'\"\`]block[\'\"\`]\;?/m) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-094.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-094.md deleted file mode 100644 index 3b804fc655..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-094.md +++ /dev/null @@ -1,483 +0,0 @@ ---- -id: 5d7dea508360d21c6826a9af -title: Part 94 -challengeType: 0 -dashedName: part-94 ---- - -# --description-- - -Now set the `innerText` property of `monsterNameText` to equal `monsters[fighting].name`. Also, set the `innerText` property of `monsterHealthText` to equal `monsterHealth`. - -# --hints-- - -See description above for instructions. - -```js -assert( - (() => { - fightBeast(); - return ( - monsterNameText.innerText === 'fanged beast' && - monsterHealthText.innerText === '60' - ); - })() && - (() => { - fightDragon(); - return ( - monsterNameText.innerText === 'dragon' && - monsterHealthText.innerText === '300' - ); - })() -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-095.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-095.md deleted file mode 100644 index 0361edec43..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-095.md +++ /dev/null @@ -1,471 +0,0 @@ ---- -id: 5d7deecc8360d21c6826a9b0 -title: Part 95 -challengeType: 0 -dashedName: part-95 ---- - -# --description-- - -We'll build out the `attack` function now. For the first line in the function, update the text message to say "The \[monster name] attacks." but replace "\[monster name]" with the actual name of the monster. Remember, you can get the monster name with `monsters[fighting].name`. - -# --hints-- - -See description above for instructions. - -```js -fightDragon(), attack(), assert(text.innerText === 'The dragon attacks.'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-096.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-096.md deleted file mode 100644 index 5b74ed5e58..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-096.md +++ /dev/null @@ -1,478 +0,0 @@ ---- -id: 5d7df0458360d21c6826a9b1 -title: Part 96 -challengeType: 0 -dashedName: part-96 ---- - -# --description-- - -Now use the `+=` operator to append more text to `text.innerText`. Add the text " You attack it with your \[weapon name]." but replace "\[weapon name]" with the actual weapon name. Remember, you can get the weapon name with `weapons[currentWeapon].name`. - -# --hints-- - -See description above for instructions. - -```js -(currentWeapon = 3), - fightDragon(), - attack(), - assert( - text.innerText === 'The dragon attacks. You attack it with your sword.' - ); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-097.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-097.md deleted file mode 100644 index 6b15d33fda..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-097.md +++ /dev/null @@ -1,475 +0,0 @@ ---- -id: 5d7df2a68360d21c6826a9b2 -title: Part 97 -challengeType: 0 -dashedName: part-97 ---- - -# --description-- - -Next, set `health` to equal `health` minus the monster's level. You can get the monster's level with `monsters[fighting].level`. - -# --hints-- - -See description above for instructions. - -```js -(health = 50), fightDragon(), attack(), assert(health === 30); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-098.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-098.md deleted file mode 100644 index f4683e6bc9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-098.md +++ /dev/null @@ -1,477 +0,0 @@ ---- -id: 5d7df41a8360d21c6826a9b3 -title: Part 98 -challengeType: 0 -dashedName: part-98 ---- - -# --description-- - -Set `monsterHealth` to `monsterHealth` minus the power of the current weapon (`weapons[currentWeapon].power`). - -# --hints-- - -See description above for instructions. - -```js -fightDragon(), (monsterHealth = 20), attack(), assert(monsterHealth === 15); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-099.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-099.md deleted file mode 100644 index bd3cbd8d48..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-099.md +++ /dev/null @@ -1,484 +0,0 @@ ---- -id: 5d7df75a8360d21c6826a9b4 -title: Part 99 -challengeType: 0 -dashedName: part-99 ---- - -# --description-- - -At the end of that line, add a random number between one and the value of `xp`. Here is the formula to get a random number between 1 and 5: `Math.floor(Math.random() * 5) + 1`. - -`Math.random()` returns a decimal or floating point number between 0 and 1, and `Math.floor()` rounds a given number down to the nearest integer. - -# --hints-- - -See description above for instructions. - -```js -(xp = 1), - fightDragon(), - (monsterHealth = 20), - attack(), - assert(monsterHealth === 14); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-100.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-100.md deleted file mode 100644 index 1f7732f04f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-100.md +++ /dev/null @@ -1,485 +0,0 @@ ---- -id: 5d7dfb908360d21c6826a9b5 -title: Part 100 -challengeType: 0 -dashedName: part-100 ---- - -# --description-- - -Update `healthText.innerText` and `monsterHealthText.innerText` to equal `health` and `monsterHealth`. - -# --hints-- - -See description above for instructions. - -```js -(xp = 1), - (health = 50), - fightDragon(), - (monsterHealth = 20), - attack(), - assert(monsterHealthText.innerText === '14' && healthText.innerText === '30'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-101.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-101.md deleted file mode 100644 index 60d5157b2b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-101.md +++ /dev/null @@ -1,489 +0,0 @@ ---- -id: 5d7e02c88360d21c6826a9b7 -title: Part 101 -challengeType: 0 -dashedName: part-101 ---- - -# --description-- - -Check if health is less than or equal to zero. If it is, call the `lose()` function. - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .match(/^\s*if\s*\(\s*health\s*\<\=\s*0\s*\)\s*\{\s*lose\(\s*\);?\s*\}/m) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-102.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-102.md deleted file mode 100644 index 47874a2616..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-102.md +++ /dev/null @@ -1,508 +0,0 @@ ---- -id: 5d7e06728360d21c6826a9b8 -title: Part 102 -challengeType: 0 -dashedName: part-102 ---- - -# --description-- - -An `else` statement can be conditional with an `else if` statement. At the end of the `if` statement, add an `else if` statement to check if `monsterHealth` is less than or equal to zero. Inside the `else if` block, call the `defeatMonster()` function. - -Here is an example of an `if` statement with `else if` and `else`: - -```js -if (num > 15) { - return "Bigger than 15"; -} else if (num < 5) { - return "Smaller than 5"; -} else { - return "Between 5 and 15"; -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .match( - /^\s*if\s*\(\s*health\s*\<\=\s*0\s*\)\s*\{\s*lose\(\s*\);?\s*\}\s*else if\s*\(\s*monsterHealth\s*\<\=\s*0\s*\)\s*\{\s*defeatMonster\(\s*\)\;?\s*\}/m - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-103.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-103.md deleted file mode 100644 index 5df47c54bd..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-103.md +++ /dev/null @@ -1,498 +0,0 @@ ---- -id: 5d7e077e8360d21c6826a9b9 -title: Part 103 -challengeType: 0 -dashedName: part-103 ---- - -# --description-- - -At the end of the code add two empty functions named `defeatMonster` and `lose`. - -# --hints-- - -See description above for instructions. - -```js -assert(typeof defeatMonster === 'function' && typeof lose === 'function'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-104.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-104.md deleted file mode 100644 index 295fcda0c0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-104.md +++ /dev/null @@ -1,507 +0,0 @@ ---- -id: 5d7e13798360d21c6826a9bb -title: Part 104 -challengeType: 0 -dashedName: part-104 ---- - -# --description-- - -Inside the `dodge` function, set `text.innerText` equal to "You dodge the attack from the \[monster's name]." Instead of "\[monster's name]", get the monster's name with `monsters[fighting].name`. - -# --hints-- - -See description above for instructions. - -```js -fightDragon(), - dodge(), - assert(text.innerText === 'You dodge the attack from the dragon.'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-105.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-105.md deleted file mode 100644 index dc57d38ff7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-105.md +++ /dev/null @@ -1,509 +0,0 @@ ---- -id: 5d7f3b6c7c4263f469c36b17 -title: Part 105 -challengeType: 0 -dashedName: part-105 ---- - -# --description-- - -In the `defeatMonster` function, set `gold` to equal `gold` plus the monster's level times 6.7. You can get the monster's level with `monsters[fighting].level`. - -Here is how you would set `num` to equal `num` plus five times eight: `num += 5 * 8`. Remember that `Math.floor()` rounds any number passed to it down to the nearest whole number. - -# --hints-- - -See description above for instructions. - -```js -(gold = 10), fightSlime(), defeatMonster(), assert(gold === 23); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-106.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-106.md deleted file mode 100644 index 152059279f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-106.md +++ /dev/null @@ -1,509 +0,0 @@ ---- -id: 5d7f405c7c4263f469c36b18 -title: Part 106 -challengeType: 0 -dashedName: part-106 ---- - -# --description-- - -Set `xp` to equal `xp` plus the monster's level. - -# --hints-- - -See description above for instructions. - -```js -(xp = 10), fightSlime(), defeatMonster(), assert(xp === 12); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-107.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-107.md deleted file mode 100644 index b21cfd70ac..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-107.md +++ /dev/null @@ -1,516 +0,0 @@ ---- -id: 5d7f410b7c4263f469c36b19 -title: Part 107 -challengeType: 0 -dashedName: part-107 ---- - -# --description-- - -Now set the `innerText` properties of `goldText` and `xpText` to the updated values. - -# --hints-- - -See description above for instructions. - -```js -(xp = 10), - (gold = 10), - fightSlime(), - defeatMonster(), - assert(goldText.innerText === '23' && xpText.innerText === '12'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-108.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-108.md deleted file mode 100644 index a4f80d2ba5..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-108.md +++ /dev/null @@ -1,518 +0,0 @@ ---- -id: 5d7f41fa7c4263f469c36b1a -title: Part 108 -challengeType: 0 -dashedName: part-108 ---- - -# --description-- - -Finish the `defeatMonster` function by calling the `update()` function and pass in `locations[4]`. - -# --hints-- - -See description above for instructions. - -```js -assert( - defeatMonster.toString().match(/^\s*update\(\s*locations\[\s*4\s*\]\s*\)/m) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-109.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-109.md deleted file mode 100644 index f686445b89..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-109.md +++ /dev/null @@ -1,532 +0,0 @@ ---- -id: 5d7f43947c4263f469c36b1b -title: Part 109 -challengeType: 0 -dashedName: part-109 ---- - -# --description-- - -Add a new object in the `locations` array with all the same properties as the other objects in the array. Set `name` to "kill monster". Set `"button text"` to `["Go to town square", "Go to town square", "Go to town square"]`. Set `"button functions"` to `[goTown, goTown, goTown]`. And set `text` to "The monster screams Arg! as it dies. You gain experience points and find gold.". - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[4], { - name: 'kill monster', - 'button text': [ - 'Go to town square', - 'Go to town square', - 'Go to town square' - ], - 'button functions': [goTown, goTown, goTown], - text: - 'The monster screams Arg! as it dies. You gain experience points and find gold.' -}); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-110.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-110.md deleted file mode 100644 index 0177434542..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-110.md +++ /dev/null @@ -1,538 +0,0 @@ ---- -id: 5d7f44ac7c4263f469c36b1c -title: Part 110 -challengeType: 0 -dashedName: part-110 ---- - -# --description-- - -The word "Arg!" should have quotes around it. Besides escaping quotes, there is another way you can include quote marks inside a quote. Change the double quotes to single quotes around the sentence, "The monster screams Arg! as it dies. You gain experience points and find gold". Then add double quotes around "Arg!" - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[4], { - name: 'kill monster', - 'button text': [ - 'Go to town square', - 'Go to town square', - 'Go to town square' - ], - 'button functions': [goTown, goTown, goTown], - text: - 'The monster screams "Arg!" as it dies. You gain experience points and find gold.' -}); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-111.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-111.md deleted file mode 100644 index 2b1d5134cb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-111.md +++ /dev/null @@ -1,542 +0,0 @@ ---- -id: 5d7f459421b11cdaa3f6b15f -title: Part 111 -challengeType: 0 -dashedName: part-111 ---- - -# --description-- - -While you're working in the `locations` array, add another object at the end. Set `name` to "lose". Set `"button text"` to `["REPLAY?", "REPLAY?", "REPLAY?"]`. Set `"button functions"` to `[restart, restart, restart]`. And set `text` to "You die. ☠️". - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[5], { - name: 'lose', - 'button text': ['REPLAY?', 'REPLAY?', 'REPLAY?'], - 'button functions': [restart, restart, restart], - text: 'You die. ☠️' -}); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
- -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-112.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-112.md deleted file mode 100644 index 4b2f082256..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-112.md +++ /dev/null @@ -1,544 +0,0 @@ ---- -id: 5d7f4d9421b11cdaa3f6b160 -title: Part 112 -challengeType: 0 -dashedName: part-112 ---- - -# --description-- - -After a monster is defeated the monster stat box should no longer display. On the first line of the `update` function add: `monsterStats.style.display = "none";`. - -# --hints-- - -See description above for instructions. - -```js -fightSlime(), defeatMonster(), assert(monsterStats.style.display === 'none'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
- -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-113.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-113.md deleted file mode 100644 index cd7d324d20..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-113.md +++ /dev/null @@ -1,546 +0,0 @@ ---- -id: 5d80c1d821b11cdaa3f6b164 -title: Part 113 -challengeType: 0 -dashedName: part-113 ---- - -# --description-- - -In the `lose` function, call the `update` function and pass in `locations[5]`. - -# --hints-- - -See description above for instructions. - -```js -update(locations[0]), lose(), assert(text.innerText === 'You die. ☠️'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
- -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-114.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-114.md deleted file mode 100644 index f1bdeebb2e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-114.md +++ /dev/null @@ -1,575 +0,0 @@ ---- -id: 5d80c3c021b11cdaa3f6b165 -title: Part 114 -challengeType: 0 -dashedName: part-114 ---- - -# --description-- - -At the end of the code, create a `restart` function. Inside the function, set `xp` to 0, set `health` to 100, set `gold` to 50, set `currentWeapon` to 0, and set `inventory` to `["stick"]`. Also, update the `innerText` properties of `goldText`, `healthText`, and `xpText` to their current values. Finally, call the `goTown()` function. - -After this step is a good time to test the game so far. - -# --hints-- - -See description above for instructions. - -```js -(currentWeapon = 1), - (inventory = ['stick', 'dagger']), - fightSlime(), - attack(), - defeatMonster(), - restart(), - assert( - xp === 0 && - gold === 50 && - currentWeapon === 0 && - inventory[0] === 'stick' && - inventory.length === 1 && - goldText.innerText === '50' && - healthText.innerText === '100' && - xpText.innerText === '0' && - text.innerText === - 'You are in the town square. You see a sign that says "Store."' - ); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-115.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-115.md deleted file mode 100644 index 2da91fb9a9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-115.md +++ /dev/null @@ -1,578 +0,0 @@ ---- -id: 5d80d20d21b11cdaa3f6b166 -title: Part 115 -challengeType: 0 -dashedName: part-115 ---- - -# --description-- - -Inside the `attack` function, update the contents of the `else if` statement. Instead of calling the `defeatMonster` function right away, create an `if` statement with an `else` statement. If the player is fighting the dragon (`fighting === 2`), then call the `winGame` function. Else, call the `defeatMonster` function. - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .match( - /^\s*\}\s*else\s*if\s*\(\s*monsterHealth\s*\<\=\s*0\s*\)\s*\{\s*if\s*\(\s*fighting\s*===\s*2\)\s*\{\s*winGame\(\s*\)\;?\s*\}\s*else\s*\{\s*defeatMonster\(\s*\)\;?\s*\}\s*\}/m - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-116.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-116.md deleted file mode 100644 index a648dc53a4..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-116.md +++ /dev/null @@ -1,592 +0,0 @@ ---- -id: 5d80d67021b11cdaa3f6b167 -title: Part 116 -challengeType: 0 -dashedName: part-116 ---- - -# --description-- - -The conditional operator, also called the ternary operator, can be used as a one line if-else expression. The syntax is: `condition ? statement-if-true : statement-if-false;`. - -Change the if-else expression from the last challenge to use the ternary operator instead. Here is an example: - -```js -if (age >= 18) { - adultFunction(); -} else { - kidFunction(); -} - -// The above if-else expression does the same thing as the following line - -age >= 18 ? adultFunction() : kidFunction(); -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .match( - /^\s*\}\s*else\s*if\s*\(\s*monsterHealth\s*\<\=\s*0\s*\)\s*\{\s*fighting\s*\=\=\=\s*2\s*\?\s*winGame\(\s*\)\s*\:\s*defeatMonster\(\s*\)\;?\s*\}/m - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-117.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-117.md deleted file mode 100644 index d2f4277b03..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-117.md +++ /dev/null @@ -1,572 +0,0 @@ ---- -id: 5d80da7521b11cdaa3f6b168 -title: Part 117 -challengeType: 0 -dashedName: part-117 ---- - -# --description-- - -After the `lose` function, create a function called `winGame`. Inside the `winGame` function, call the `update` function and pass in `locations[6]`. - -# --hints-- - -See description above for instructions. - -```js -assert(winGame.toString().replace(/\s/g, '').includes('update(locations[6])')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-118.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-118.md deleted file mode 100644 index 5544e87fe0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-118.md +++ /dev/null @@ -1,587 +0,0 @@ ---- -id: 5dbab6d36ef5fe3a704f848c -title: Part 118 -challengeType: 0 -dashedName: part-118 ---- - -# --description-- - -Add another object in the `locations` array. Everything should be the same as the "lose" element, except the `name` should be "win" and the text should be "You defeat the dragon! YOU WIN THE GAME! 🎉" - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[6], { - name: 'win', - 'button text': ['Fight slime', 'Fight fanged beast', 'Go to town square'], - 'button functions': [restart, restart, restart], - text: 'You defeat the dragon! YOU WIN THE GAME! 🎉' -}); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-119.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-119.md deleted file mode 100644 index 3e79f91c2f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-119.md +++ /dev/null @@ -1,595 +0,0 @@ ---- -id: 5dbabb746ef5fe3a704f848d -title: Part 119 -challengeType: 0 -dashedName: part-119 ---- - -# --description-- - -The game could be complete now, but let's make it more interesting. - -Inside the `attack` function, change the line `health -= monsters[fighting].level;` to `health -= getMonsterAttackValue(monsters[fighting].level);` This sets `health` to equal `health` minus the return value of the `getMonsterAttackValue` function. Also, pass the level of the monster to `getMonsterAttackValue` as an argument. - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .replace(/\s/g, '') - .includes('health-=getMonsterAttackValue(monsters[fighting].level') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-120.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-120.md deleted file mode 100644 index 9a1eb4d22d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-120.md +++ /dev/null @@ -1,594 +0,0 @@ ---- -id: 5dbac08e6ef5fe3a704f848f -title: Part 120 -challengeType: 0 -dashedName: part-120 ---- - -# --description-- - -Under the `attack` function, create a function with name `getMonsterAttackValue` that takes `level` as a parameter. - -# --hints-- - -See description above for instructions. - -```js -assert( - getMonsterAttackValue.toString().replace(/\s/g, '') === - 'functiongetMonsterAttackValue(level){}' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-121.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-121.md deleted file mode 100644 index 50e8300f07..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-121.md +++ /dev/null @@ -1,601 +0,0 @@ ---- -id: 5dbac0c86ef5fe3a704f8490 -title: Part 121 -challengeType: 0 -dashedName: part-121 ---- - -# --description-- - -The attack of the monster will be based on the monster's level and player's `xp`. In the `getMonsterAttackValue` function, use `const` to create a variable called `hit`. Set it to equal the equation `(level * 5) - (Math.floor(Math.random() * xp))`. - -# --hints-- - -See description above for instructions. - -```js -assert( - getMonsterAttackValue - .toString() - .replace(/\s/g, '') - .includes('varhit=level*5-Math.floor(Math.random()*xp)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-122.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-122.md deleted file mode 100644 index 2c8de55b40..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-122.md +++ /dev/null @@ -1,604 +0,0 @@ ---- -id: 5dbac1f16ef5fe3a704f8491 -title: Part 122 -challengeType: 0 -dashedName: part-122 ---- - -# --description-- - -Log the value of `hit` to the console to use in debugging. - -Here is how to log the value of `num` to the console: `console.log(num);`. - -# --hints-- - -See description above for instructions. - -```js -assert( - getMonsterAttackValue - .toString() - .replace(/\s/g, '') - .includes('console.log(hit)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-123.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-123.md deleted file mode 100644 index 7ccf018a43..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-123.md +++ /dev/null @@ -1,611 +0,0 @@ ---- -id: 5dbac2b06ef5fe3a704f8492 -title: Part 123 -challengeType: 0 -dashedName: part-123 ---- - -# --description-- - -Now return `hit` from the `getMonsterAttackValue` function. The return value of this function is used in the `attack` function. - -Here is an example of a function that returns a value: - -```js -function plusThree(num) { - let numPlusThree = num + 3; - return numPlusThree; -} - -const answer = plusThree(5); // 8 -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - getMonsterAttackValue.toString().replace(/\s/g, '').includes('returnhit') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-124.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-124.md deleted file mode 100644 index 8f9d1b0f76..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-124.md +++ /dev/null @@ -1,614 +0,0 @@ ---- -id: 5dbbb5076ef5fe3a704f849d -title: Part 124 -challengeType: 0 -dashedName: part-124 ---- - -# --description-- - -If you play the game in its current state you might notice a bug. If your `xp` is high enough, the `getMonsterAttackValue` function will sometimes return a negative number, which will actually add to your total health when fighting a monster! - -In `getMonsterAttackValue`, change `return hit` to a ternary operator that returns `hit` if `hit` is greater than 0, or returns 0 if it is not. - -For example, here's a function that returns 5 if `tickets` is greater than 3, or returns 0 if it is not: - -```js -function applyDiscount(tickets) { - return tickets > 2 : 5 : 0; -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - getMonsterAttackValue - .toString() - .replace(/\s/g, '') - .includes('returnhit>0?hit:0') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-125.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-125.md deleted file mode 100644 index 62d444f251..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-125.md +++ /dev/null @@ -1,609 +0,0 @@ ---- -id: 5dbac6176ef5fe3a704f8493 -title: Part 125 -challengeType: 0 -dashedName: part-125 ---- - -# --description-- - -In the `attack` function after the line `health -= getMonsterAttackValue(monsters[fighting].level);`, create an empty if expression. For the condition, put the function call `isMonsterHit()`. - -Here is an example of an empty if expression with a function call as the condition: - -```js -if (isTrue()) { - -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert(attack.toString().replace(/\s/g, '').includes('if(isMonsterHit()){}')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-126.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-126.md deleted file mode 100644 index b2107ec1f0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-126.md +++ /dev/null @@ -1,620 +0,0 @@ ---- -id: 5dbaca566ef5fe3a704f8494 -title: Part 126 -challengeType: 0 -dashedName: part-126 ---- - -# --description-- - -In the `attack` function, move the line `monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1;` into the `if` block. - -Here is an example of code in an `if` block that logs a message to the console: - -```js -if (isTrue()) { - console.log("It's true!"); -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .replace(/\s/g, '') - .match( - /if\(isMonsterHit\(\)\)\{monsterHealth\-\=weapons\[currentWeapon\]\.power\+Math\.floor\(Math\.random\(\)\*xp\)\+1;?\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-127.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-127.md deleted file mode 100644 index 85efb551ae..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-127.md +++ /dev/null @@ -1,614 +0,0 @@ ---- -id: 5dbae0446ef5fe3a704f8495 -title: Part 127 -challengeType: 0 -dashedName: part-127 ---- - -# --description-- - -Add an `else` expression to the `if` expression. Use the `+=` operator to add the text " You miss." onto the end of `text.innerText`. - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .replace(/\s/g, '') - .match( - /if\(isMonsterHit\(\)\)\{monsterHealth\-\=weapons\[currentWeapon\]\.power\+Math\.floor\(Math\.random\(\)\*xp\)\+1;?\}else\{text\.innerText\+\=[\'\"\`]Youmiss.[\'\"\`]\;?\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-128.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-128.md deleted file mode 100644 index 5ded47315c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-128.md +++ /dev/null @@ -1,630 +0,0 @@ ---- -id: 5dbae1f66ef5fe3a704f8496 -title: Part 128 -challengeType: 0 -dashedName: part-128 ---- - -# --description-- - -Now create the `isMonsterHit` function. It will return a boolean to be used in the `if` expression. Return the result of the comparison `Math.random() > .2`. - -Here is a function that returns the result of a comparison: - -```js -function flipHeads() { - return Math.random() > .5; -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - isMonsterHit - .toString() - .replace(/\s/g, '') - .includes('returnMath.random()>.2') || - isMonsterHit - .toString() - .replace(/\s/g, '') - .includes('returnMath.random()>0.2') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-129.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-129.md deleted file mode 100644 index 9fc1336bd5..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-129.md +++ /dev/null @@ -1,628 +0,0 @@ ---- -id: 5dbba5716ef5fe3a704f8497 -title: Part 129 -challengeType: 0 -dashedName: part-129 ---- - -# --description-- - -The player should hit if either `Math.random() > .2` OR if the player's health is less than 20. At the end of the return statement, add the "logical or" operator (`||`) and then check if `health` is less than 20. - -Here is an example that returns true if either a number is less than 10 or more than 20: `num < 10 || num > 20`. - -# --hints-- - -See description above for instructions. - -```js -assert( - isMonsterHit - .toString() - .replace(/\s/g, '') - .includes('returnMath.random()>.2||health<20') || - isMonsterHit - .toString() - .replace(/\s/g, '') - .includes('returnMath.random()>0.2||health<20') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-130.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-130.md deleted file mode 100644 index 0d3f4e0a31..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-130.md +++ /dev/null @@ -1,625 +0,0 @@ ---- -id: 5dbba70e6ef5fe3a704f8498 -title: Part 130 -challengeType: 0 -dashedName: part-130 ---- - -# --description-- - -On every attack, there should be a small chance that the player's weapon breaks. At the end of the `attack` function, add an empty `if` expression with the condition `Math.random() <= .1`. - -# --hints-- - -See description above for instructions. - -```js -assert( - attack.toString().replace(/\s/g, '').includes('if(Math.random()<=.1){}') || - isMonsterHit - .toString() - .replace(/\s/g, '') - .includes('if(Math.random()<=0.1){}') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-131.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-131.md deleted file mode 100644 index 041946ae73..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-131.md +++ /dev/null @@ -1,646 +0,0 @@ ---- -id: 5dbba89e6ef5fe3a704f8499 -title: Part 131 -challengeType: 0 -dashedName: part-131 ---- - -# --description-- - -Use the `+=` operator to add "Your \[last item in inventory array] breaks." to the end of `text.innerText`. Instead of the bracketed text, it should show the actual item name. - -Use `inventory.pop()` to both remove the last element from the array AND return that element. For example: - -```js -let shoppingList = ["milk", "apples", "cereal"]; -console.log("I bought " + shoppingList.pop() + "."); // Logs "I bought cereal." -// shoppingList now equals ["milk", "apples"] -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .replace(/\s/g, '') - .match( - /if\(Math\.random\(\)\<\=0?\.1\)\{text\.innerText\+\=\"Your\"\+inventory\.pop\(\)\+\"breaks\.\"\;?\}/ - ) || - attack - .toString() - .replace(/\s/g, '') - .match( - /if\(Math\.random\(\)\<\=0?\.1\)\{text\.innerText\+\=\"Your\"\.concat\(inventory\.pop\(\)\,\"breaks\.\"\)\;?\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-132.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-132.md deleted file mode 100644 index 307889edf7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-132.md +++ /dev/null @@ -1,632 +0,0 @@ ---- -id: 5dbbaeb56ef5fe3a704f849a -title: Part 132 -challengeType: 0 -dashedName: part-132 ---- - -# --description-- - -Decrement the value of `currentWeapon` using `--`. For example, say `num` equals 5. After running `num--`, `num` now equals 4. - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .replace(/\s/g, '') - .match( - /if\(Math\.random\(\)\<\=0?\.1\)\{text\.innerText\+\=\"Your\"\+inventory\.pop\(\)\+\"breaks\.\"\;?currentWeapon--\;?\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-133.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-133.md deleted file mode 100644 index ea35840058..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-133.md +++ /dev/null @@ -1,643 +0,0 @@ ---- -id: 5dbbb00e6ef5fe3a704f849b -title: Part 133 -challengeType: 0 -dashedName: part-133 ---- - -# --description-- - -We don't want a player's only weapon to break. - -Use the "logical and" operator (`&&`) to add a second condition to the `if` expression you just wrote. A player's weapon should only be able to break if `inventory.length` does not equal (`!==`) one. - -Here is an example of an `if` expression with the conditions that `firstName` equals "Quincy" AND `lastName` does NOT equal "Larson". With `&&`, both conditions must be true or else the entire statement evaluates to false. - -```js -if (firstName === "Quincy" && lastName !== "Larson") { - console.log("Cool name but not the creator of freeCodeCamp.org.") -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - attack - .toString() - .replace(/\s/g, '') - .match( - /if\(Math\.random\(\)\<\=0?\.1\&\&inventory\.length\!\=\=1\)\{text\.innerText\+\=\"Your\"\+inventory\.pop\(\)\+\"breaks\.\"\;?currentWeapon--\;?\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-134.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-134.md deleted file mode 100644 index d73015dadc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-134.md +++ /dev/null @@ -1,637 +0,0 @@ ---- -id: 5dbbb1466ef5fe3a704f849c -title: Part 134 -challengeType: 0 -dashedName: part-134 ---- - -# --description-- - -The only thing left to add is a mini-game easter egg (a hidden feature). - -Add a new function called `easterEgg` that calls the `update` function and passes in `locations[7]` as an argument. - -# --hints-- - -See description above for instructions. - -```js -assert( - easterEgg - .toString() - .replace(/\s/g, '') - .match(/functioneasterEgg\(\)\{(return)?update\(locations\[7\]\)\;?}/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-135.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-135.md deleted file mode 100644 index 6c4fded964..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-135.md +++ /dev/null @@ -1,651 +0,0 @@ ---- -id: 5dbbf3796ef5fe3a704f849e -title: Part 135 -challengeType: 0 -dashedName: part-135 ---- - -# --description-- - -Add a new object to the `locations` array. - -Set `name` to "easter egg", `"button text"` to `["2", "8", "Go to town square?"]`, `"button functions"` to `[pickTwo, pickEight, goTown]`, and `text` to "You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!" - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[7], { - name: 'easter egg', - 'button text': ['2', '8', 'Go to town square?'], - 'button functions': [pickTwo, pickEight, goTown], - text: - 'You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!' -}); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
- -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-136.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-136.md deleted file mode 100644 index efd107afd6..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-136.md +++ /dev/null @@ -1,662 +0,0 @@ ---- -id: 5dbbf8d86ef5fe3a704f849f -title: Part 136 -challengeType: 0 -dashedName: part-136 ---- - -# --description-- - -At the end of the code, add two new functions named `pickTwo` and `pickEight`. - -Inside each function call the `pick()` function. Pass either "2" or "8" as arguments to `pick` depending on the function name. - -# --hints-- - -See description above for instructions. - -```js -assert( - pickTwo.toString().replace(/\s/g, '').includes('pick(2)') && - pickEight.toString().replace(/\s/g, '').includes('pick(8)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
- -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-137.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-137.md deleted file mode 100644 index 3d42d7bf29..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-137.md +++ /dev/null @@ -1,664 +0,0 @@ ---- -id: 5dbc23a66ef5fe3a704f84a0 -title: Part 137 -challengeType: 0 -dashedName: part-137 ---- - -# --description-- - -Add a `pick` function with a parameter named "guess". - -# --hints-- - -See description above for instructions. - -```js -assert(pick.toString().replace(/\s/g, '').includes('functionpick(guess){}')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-138.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-138.md deleted file mode 100644 index 3f07a2a595..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-138.md +++ /dev/null @@ -1,675 +0,0 @@ ---- -id: 5dbc2c506ef5fe3a704f84a1 -title: Part 138 -challengeType: 0 -dashedName: part-138 ---- - -# --description-- - -Inside `pick`, use `let` to initialize a variable named "numbers" and set it to an empty array. - -# --hints-- - -See description above for instructions. - -```js -assert( - pick - .toString() - .replace(/\s/g, '') - .match(/functionpick\(guess\)\{varnumbers\=\[\]\;?\}/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-139.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-139.md deleted file mode 100644 index 67782d1950..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-139.md +++ /dev/null @@ -1,692 +0,0 @@ ---- -id: 5dbc2d056ef5fe3a704f84a2 -title: Part 139 -challengeType: 0 -dashedName: part-139 ---- - -# --description-- - -Inside `pick`, create a `while` loop to run the same code multiple times. The code inside the `while` loop should keep repeating while `numbers.length` is less than 10 and stop once that condition is no longer true. - -Here is an example of a while loop that repeats code inside the loop while `i` is less than five. - -```js -let ourArray = []; -let i = 0; -while(i < 5) { - ourArray.push(i); - i++; -} -// ourArray now equals [0,1,2,3,4] -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - pick - .toString() - .replace(/\s/g, '') - .includes( - 'while(numbers.length<10){if(_LPC++%2000===0&&Date.now()-_LP>1500){' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-140.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-140.md deleted file mode 100644 index 85f93bb2c7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-140.md +++ /dev/null @@ -1,681 +0,0 @@ ---- -id: 5dbc2f2d6ef5fe3a704f84a3 -title: Part 140 -challengeType: 0 -dashedName: part-140 ---- - -# --description-- - -Inside the `while` loop, push a random number between 0 and 10 onto the end of the `numbers` array. Get the random number with `Math.floor(Math.random() * 11)`. - -# --hints-- - -See description above for instructions. - -```js -assert( - pick - .toString() - .replace(/\s/g, '') - .includes('numbers.push(Math.floor(Math.random()*11));}') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-141.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-141.md deleted file mode 100644 index ad875cd5dc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-141.md +++ /dev/null @@ -1,679 +0,0 @@ ---- -id: 5dbc33956ef5fe3a704f84a4 -title: Part 141 -challengeType: 0 -dashedName: part-141 ---- - -# --description-- - -After the `while` loop, set `text.innerText` to equal "You picked \[guess]. Here are the random numbers:". Replace \[guess] with the actual guess. - -# --hints-- - -See description above for instructions. - -```js -pickTwo(), - assert(text.innerText === 'You picked 2. Here are the random numbers:'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-142.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-142.md deleted file mode 100644 index a788245bf3..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-142.md +++ /dev/null @@ -1,693 +0,0 @@ ---- -id: 5dbc35326ef5fe3a704f84a5 -title: Part 142 -challengeType: 0 -dashedName: part-142 ---- - -# --description-- - -Before the final end quote in the string you just added, insert the new line escape sequence (`\n`). This will cause the next part you add to `text.innerText` to appear on a new line. - -# --hints-- - -See description above for instructions. - -```js -assert( - pick - .toString() - .replace(/\s/g, '') - .includes( - 'text.innerText="Youpicked"+guess+".Herearetherandomnumbers:\\n";' - ) || - pick - .toString() - .replace(/\s/g, '') - .includes( - 'text.innerText="Youpicked".concat(guess,".Herearetherandomnumbers:\\n");' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-143.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-143.md deleted file mode 100644 index ddcf064846..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-143.md +++ /dev/null @@ -1,692 +0,0 @@ ---- -id: 5dbfced07736e5ee7d235544 -title: Part 143 -challengeType: 0 -dashedName: part-143 ---- - -# --description-- - -A `for` loop runs "for" a specific number of times. - -We will go over how for loops work in the next several steps. In the meantime, just copy the for loop below and paste it at the end of the `pick` function: - -```js -for (let x = 1; x < 5; x++) { - -} -``` - -# --hints-- - -See description above for instructions. - -```js -assert(pick.toString().replace(/\s/g, '').includes('for(varx=1;x<5;x++){')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-144.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-144.md deleted file mode 100644 index 876c77aa71..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-144.md +++ /dev/null @@ -1,692 +0,0 @@ ---- -id: 5dbfd4837736e5ee7d235545 -title: Part 144 -challengeType: 0 -dashedName: part-144 ---- - -# --description-- - -For loops are declared with three optional expressions separated by semicolons: `for ([initialization]; [condition]; [final-expression])`. - -The initialization statement is executed only one time before the loop starts and is often used to define and set up the loop variable. Think of it like declaring a variable to use as a counter in your `for` loop. - -Many `for` loops use `i` as an initializer and start from 0, so change `let x = 1;` to `let i = 0;`. - -# --hints-- - -See description above for instructions. - -```js -assert(pick.toString().replace(/\s/g, '').includes('for(vari=0;x<5;x++){')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-145.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-145.md deleted file mode 100644 index 2614aec51b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-145.md +++ /dev/null @@ -1,690 +0,0 @@ ---- -id: 5dbfdb737736e5ee7d235546 -title: Part 145 -challengeType: 0 -dashedName: part-145 ---- - -# --description-- - -The second statement in a `for` loop, the condition statement, is evaluated at the beginning of every loop iteration. The loop will continue as long as it evaluates to true. - -We want the loop to run 10 times, so change `x < 5` to `i < 10`. - -# --hints-- - -See description above for instructions. - -```js -assert(pick.toString().replace(/\s/g, '').includes('for(vari=0;i<10;x++){')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-146.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-146.md deleted file mode 100644 index e6593263c0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-146.md +++ /dev/null @@ -1,690 +0,0 @@ ---- -id: 5dbfdc377736e5ee7d235547 -title: Part 146 -challengeType: 0 -dashedName: part-146 ---- - -# --description-- - -The last statement in a `for` loop is the final-expression, and is executed at the end of each loop iteration. - -Since we changed the initializer from `x` to `i`, change `x++` to `i++`. This will iterate the initializer `i` by 1 after each loop. - -# --hints-- - -See description above for instructions. - -```js -assert(pick.toString().replace(/\s/g, '').includes('for(vari=0;i<10;i++){')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-147.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-147.md deleted file mode 100644 index 4ba199d139..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-147.md +++ /dev/null @@ -1,693 +0,0 @@ ---- -id: 5dbfe2f37736e5ee7d235548 -title: Part 147 -challengeType: 0 -dashedName: part-147 ---- - -# --description-- - -Inside the for loop, use the `+=` operator to add to the end of `text.innerText`. Add the the number at index `i` in the `numbers` array with `numbers[i]`. Then add a new line. So the entire line inside the for loop should look like: `text.innerText += numbers[i] + "\n";` - -# --hints-- - -See description above for instructions. - -```js -assert( - pick - .toString() - .replace(/\s/g, '') - .includes('text.innerText+=numbers[i]+"\\n";}}') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-148.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-148.md deleted file mode 100644 index fe8ebc1c01..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-148.md +++ /dev/null @@ -1,699 +0,0 @@ ---- -id: 5dbfeffe7736e5ee7d235549 -title: Part 148 -challengeType: 0 -dashedName: part-148 ---- - -# --description-- - -The `indexOf()` array method returns the first index at which a given element can be found in the array, or -1 if it is not present. - -After the for loop, add an `if` expression to check if the guessed number is in the `numbers` array. The condition of the `if` expression should check if `numbers.indexOf(guess) !== -1`. - -# --hints-- - -See description above for instructions. - -```js -assert( - pick - .toString() - .replace(/\s/g, '') - .includes('if(numbers.indexOf(guess)!==-1){}') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-149.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-149.md deleted file mode 100644 index 753caba8e7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-149.md +++ /dev/null @@ -1,705 +0,0 @@ ---- -id: 5dbff18d7736e5ee7d23554a -title: Part 149 -challengeType: 0 -dashedName: part-149 ---- - -# --description-- - -Inside the `if` expression, add the following string to the end of `text.innerText`: "Right! You win 20 gold!" Also, add 20 to the value of `gold` and update `goldText.innerText`. - -# --hints-- - -See description above for instructions. - -```js -assert( - pick - .toString() - .replace(/\s/g, '') - .includes('text.innerText+="Right!Youwin20gold!";') && - pick.toString().replace(/\s/g, '').includes('gold+=20;') && - pick.toString().replace(/\s/g, '').includes('goldText.innerText=gold;') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-150.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-150.md deleted file mode 100644 index 53d6a01dd0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-150.md +++ /dev/null @@ -1,712 +0,0 @@ ---- -id: 5dbff2d07736e5ee7d23554b -title: Part 150 -challengeType: 0 -dashedName: part-150 ---- - -# --description-- - -Add an `else` expression. Inside add "Wrong! You lose 10 health!" to the end of `text.innerText`. Also, subtract 10 from `health` and update `healthText.innerText`. - -# --hints-- - -See description above for instructions. - -```js -assert( - pick.toString().replace(/\s/g, '').includes('else{') && - pick - .toString() - .replace(/\s/g, '') - .includes('text.innerText+="Wrong!Youlose10health!";') && - pick.toString().replace(/\s/g, '').includes('health-=10;') && - pick.toString().replace(/\s/g, '').includes('healthText.innerText=health;') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-151.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-151.md deleted file mode 100644 index 20095d9bcd..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-151.md +++ /dev/null @@ -1,718 +0,0 @@ ---- -id: 5dbffd907736e5ee7d23554c -title: Part 151 -challengeType: 0 -dashedName: part-151 ---- - -# --description-- - -At the end of the `else` statement, check if `health` is less than or equal to zero. If so, call the `lose()` function. - -# --hints-- - -See description above for instructions. - -```js -assert( - pick - .toString() - .replace(/\s/g, '') - .includes( - 'else{text.innerText+="Wrong!Youlose10health!";health-=10;healthText.innerText=health;if(health<=0){lose();}}' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-152.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-152.md deleted file mode 100644 index 871a954431..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-152.md +++ /dev/null @@ -1,724 +0,0 @@ ---- -id: 5dbffe887736e5ee7d23554d -title: Part 152 -challengeType: 0 -dashedName: part-152 ---- - -# --description-- - -Inside the `locations` array, on the `kill monster` object, "button functions" is currently set to `[goTown, goTown, goTown]`. Change the third `goTown` to `easterEgg`. This is how a player will access the hidden feature of the game. - -# --hints-- - -See description above for instructions. - -```js -assert.deepStrictEqual(locations[4], { - name: 'kill monster', - 'button text': [ - 'Go to town square', - 'Go to town square', - 'Go to town square' - ], - 'button functions': [goTown, goTown, easterEgg], - text: - 'The monster screams "Arg!" as it dies. You gain experience points and find gold.' -}); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-153.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-153.md deleted file mode 100644 index deec67837f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-153.md +++ /dev/null @@ -1,714 +0,0 @@ ---- -id: 5dc01a727736e5ee7d23554f -title: Part 153 -challengeType: 0 -dashedName: part-153 ---- - -# --description-- - -Congratulations! You are finished! Now try out the game. - -# --hints-- - -See description above for instructions. - -```js - -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - RPG - Dragon Repeller - - - -
-
- XP: 0 - Health: 100 - Gold: 50 -
-
- - - -
-
- Monster Name: - Health: -
-
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-001.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-001.md deleted file mode 100644 index a07d71fd5f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-001.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -id: 5d79253297c0ebb149ea9fed -title: Part 1 -challengeType: 0 -dashedName: part-1 ---- - -# --description-- - -In functional programming, we prefer immutable values over mutable values. - -Mutable values (declared with `var` or `let`) can lead to unexpected behaviors and bugs. Values declared with `const` cannot be reassigned, which makes using them easier because you don't have to keep track of their values. - -Start by creating an empty `infixToFunction` object using `const`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('constinfixToFunction={}')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-002.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-002.md deleted file mode 100644 index d606fa81f6..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-002.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -id: 5d7925323be8848dbc58a07a -title: Part 2 -challengeType: 0 -dashedName: part-2 ---- - -# --description-- - -Above `infixToFunction`, define an empty function `add` using the `function` keyword. It should accept two parameters, `x` and `y`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('functionadd(x,y){}')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-003.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-003.md deleted file mode 100644 index 647d15759d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-003.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -id: 5d792532f631702ae6d23e11 -title: Part 3 -challengeType: 0 -dashedName: part-3 ---- - -# --description-- - -Now return the sum of `x` and `y` using the `return` keyword. - -# --hints-- - -See description above for instructions. - -```js -assert(add(1, 2) === 3 && add(100, 2000) === 2100); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-004.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-004.md deleted file mode 100644 index dae790c420..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-004.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -id: 5d7925329445167ecc2ac9c9 -title: Part 4 -challengeType: 0 -dashedName: part-4 ---- - -# --description-- - -In JavaScript, functions are first class. This means that they can be used like any other values - for example, they can be assigned to variables. - -Assign `add` to a new variable `addVar`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('constaddVar=add')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-005.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-005.md deleted file mode 100644 index af810c3b9a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-005.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -id: 5d792532b07918c3a5904913 -title: Part 5 -challengeType: 0 -dashedName: part-5 ---- - -# --description-- - -Anonymous functions are functions without names - they are used only once and then forgotten. The syntax is the same as for normal functions but without the name: - -```js -function(x) { - return x -} -``` - -First, remove the `addVar` definition. - -# --hints-- - -See description above for instructions. - -```js -assert(!code.replace(/\s/g, '').includes('constaddVar=add')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-006.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-006.md deleted file mode 100644 index de60cac762..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-006.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -id: 5d792533cc8b18b6c133edc7 -title: Part 6 -challengeType: 0 -dashedName: part-6 ---- - -# --description-- - -Anonymous functions are often passed as arguments to other functions, but what if you want to call one later? You can assign anonymous functions to variables and call them with the variable's name: - -```js -const fn = function(x) { - return x; -} - -fn(); -``` - -Assign the anonymous function to the variable `addVar`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('constaddVar=function(x,y){returnx+y')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-007.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-007.md deleted file mode 100644 index d0b9f3ab38..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-007.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -id: 5d7925337954ed57a565a135 -title: Part 7 -challengeType: 0 -dashedName: part-7 ---- - -# --description-- - -This is possible because the anonymous function has been immediately assigned to a value - this is effectively the same as using a named function. - -Rewrite `addVar` using ES6's arrow syntax: - -```js -const fn = (x, y) => x; -``` - -Note that the value is returned implicitly. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('constaddVar=(x,y)=>x+y')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-008.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-008.md deleted file mode 100644 index 1251a61d04..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-008.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -id: 5d79253352e33dd59ec2f6de -title: Part 8 -challengeType: 0 -dashedName: part-8 ---- - -# --description-- - -Add the key `+` to `infixToFunction` and assign it the value `addVar`. - -# --hints-- - -See description above for instructions. - -```js -assert(infixToFunction['+'].toString() === addVar.toString()); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-009.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-009.md deleted file mode 100644 index b7b8112705..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-009.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -id: 5d792533d31e4f7fad33011d -title: Part 9 -challengeType: 0 -dashedName: part-9 ---- - -# --description-- - -In `infixToFunction`, replace `addVar` with `(x, y) => x + y`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/\+["']:\(x,y\)=>x\+y/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-010.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-010.md deleted file mode 100644 index f9b66cf731..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-010.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -id: 5d792533e7707b9645d7b540 -title: Part 10 -challengeType: 0 -dashedName: part-10 ---- - -# --description-- - -Remove the now redundant `addVar` definition. - -# --hints-- - -See description above for instructions. - -```js -assert(typeof addVar === 'undefined'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-011.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-011.md deleted file mode 100644 index 90a6a432c3..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-011.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -id: 5d79253378595ec568f70ab6 -title: Part 11 -challengeType: 0 -dashedName: part-11 ---- - -# --description-- - -Add similar definitions for `-`, `*` and `/` in `infixToFunction`. - -# --hints-- - -See description above for instructions. - -```js -assert( - infixToFunction['-'](10, 2) === 8 && - infixToFunction['*'](10, 10) === 100 && - infixToFunction['/'](100, 10) === 10 -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-012.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-012.md deleted file mode 100644 index 8fa7ce4708..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-012.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -id: 5d7925330918ae4a2f282e7e -title: Part 12 -challengeType: 0 -dashedName: part-12 ---- - -# --description-- - -Use arrow function syntax to define a function `infixEval` which takes `str` and `regex` as arguments and returns `str.replace(regex, "")`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constinfixEval=\(str,regex\)=>str\.replace\(regex,['"]{2}\)/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-013.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-013.md deleted file mode 100644 index c4d07bd668..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-013.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -id: 5d792533ed00e75d129e1b18 -title: Part 13 -challengeType: 0 -dashedName: part-13 ---- - -# --description-- - -`replace` is a higher order function because it can take a function as argument (higher order functions can also return functions). - -Pass the `+` function from `infixToFunction` to the `replace` method as the second argument. - -This is how you would pass the `-` function: - -```js -str.replace(regex, infixToFunction["-"]) -``` - -# --hints-- - -See description above for instructions. - -```js -assert(infixEval('ab', /(a)b/) === 'aba'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-014.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-014.md deleted file mode 100644 index 68c6d5ee0c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-014.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -id: 5d792533a5c42fb4d1a4b70d -title: Part 14 -challengeType: 0 -dashedName: part-14 ---- - -# --description-- - -Replace the second argument of `str.replace` with an anonymous function, which takes `match`, `arg1`, `fn`, and `arg2`, and returns `infixToFunction["+"]`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('str.replace(regex,(match,arg1,fn,arg2)=>infixToFunction["+"])') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-015.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-015.md deleted file mode 100644 index 822205dcc1..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-015.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -id: 5d79253358e8f646cbeb2bb0 -title: Part 15 -challengeType: 0 -dashedName: part-15 ---- - -# --description-- - -Change the `"+"` in the call to `infixToFunction` to `fn`. - -`fn` is the operator that the user inputs (`+`, `-`, `*` or `/`) - we use `infixToFunction` to get the function that corresponds to it. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('str.replace(regex,(match,arg1,fn,arg2)=>infixToFunction[fn])') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-016.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-016.md deleted file mode 100644 index fafef384b9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-016.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: 5d792533bb38fab70b27f527 -title: Part 16 -challengeType: 0 -dashedName: part-16 ---- - -# --description-- - -`arg1` and `arg2` are the numbers input by the user in a string such as "1+3". - -Pass `parseFloat(arg1)` and `parseFloat(arg2)` as the arguments to `infixToFunction[fn]` (remember `infixToFunction[fn]` is a function). - -# --hints-- - -See description above for instructions. - -```js -const regex = /([0-9.]+)([+-\/*])([0-9.]+)/; -assert( - infixEval('23+35', regex) === '58' && - infixEval('100-20', regex) === '80' && - infixEval('10*10', regex) === '100' && - infixEval('120/6', regex) === '20' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-017.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-017.md deleted file mode 100644 index 239bec2a6c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-017.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -id: 5d79253386060ed9eb04a070 -title: Part 17 -challengeType: 0 -dashedName: part-17 ---- - -# --description-- - -The `match` parameter is currently unused, which can lead to unused variable warnings in some linters. - -To fix this, prefix or replace it with an underscore (`_`) - both ways signal to the reader and linter that you're aware you don't need this. - -Note that a single underscore can only be used once in a function and may conflict with some libraries (Lodash, Underscore.js). - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('str.replace(regex,(_')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-018.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-018.md deleted file mode 100644 index a741e0099b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-018.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -id: 5d792533717672657b81aa69 -title: Part 18 -challengeType: 0 -dashedName: part-18 ---- - -# --description-- - -When defining an arrow function with a single argument, the parentheses can be omitted: - -```js -const greeting = name => `Hello !`; -``` - -Define a function `highPrecedence` which takes a single argument `str` and returns it. - -# --hints-- - -See description above for instructions. - -```js -assert(highPrecedence('a') === 'a'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-019.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-019.md deleted file mode 100644 index df724f07d5..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-019.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -id: 5d7925335ab63018dcec11fe -title: Part 19 -challengeType: 0 -dashedName: part-19 ---- - -# --description-- - -Arrow functions can have multiple statements: - -```js -const fn = (x, y) => { - const result = x + y; - return result; // explicit return statement required -}; -``` - -Use this syntax for the `highPrecedence` function. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('highPrecedence=str=>{returnstr')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-020.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-020.md deleted file mode 100644 index 65d7ed32a9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-020.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: 5d7925330f300c342315066d -title: Part 20 -challengeType: 0 -dashedName: part-20 ---- - -# --description-- - -In `highPrecedence`, define `regex` to be `/([0-9.]+)([*\/])([0-9.]+)/`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('regex=/([0-9.]+)([*\\/])([0-9.]+)/')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-021.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-021.md deleted file mode 100644 index 677a211245..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-021.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -id: 5d792533aa6443215c9b16bf -title: Part 21 -challengeType: 0 -dashedName: part-21 ---- - -# --description-- - -Now, assign the result of calling `infixEval` with `str` and `regex` to `str2`. Return `str2`. - -# --hints-- - -See description above for instructions. - -```js -assert(highPrecedence('7*6') === '42' && highPrecedence('50/25') === '2'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-022.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-022.md deleted file mode 100644 index 0b9f1a5302..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-022.md +++ /dev/null @@ -1,118 +0,0 @@ ---- -id: 5d7925334c5e22586dd72962 -title: Part 22 -challengeType: 0 -dashedName: part-22 ---- - -# --description-- - -The ternary operator has the following syntax: - -```js -const result = condition ? valueIfTrue : valueIfFalse; -const result = 1 === 1 ? 1 : 0; // 1 -const result = 9 > 10 ? "Yes" : "No"; // "No" -``` - -Use this operator to return `str` if `str === str2`, and an empty string (`""`) otherwise. - -# --hints-- - -See description above for instructions. - -```js -assert( - highPrecedence('2*2') === '' && - highPrecedence('2+2') === '2+2' && - code.includes('?') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-023.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-023.md deleted file mode 100644 index a04e721fb2..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-023.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -id: 5d79253307ecd49e030bdcd1 -title: Part 23 -challengeType: 0 -dashedName: part-23 ---- - -# --description-- - -Recursion is when a function calls itself. We often use it instead of `while`/`for` loops, as loops usually involve mutable state. - -Replace the empty string in `highPrecedence` with a call to `highPrecedence` with `str2` as argument. - -# --hints-- - -See description above for instructions. - -```js -assert( - highPrecedence('2*2*2') === '8' && - highPrecedence('2*2') === '4' && - highPrecedence('2+2') === '2+2' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-024.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-024.md deleted file mode 100644 index 2aa72f9fde..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-024.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -id: 5d792534257122211d3043af -title: Part 24 -challengeType: 0 -dashedName: part-24 ---- - -# --description-- - -Define an object `spreadsheetFunctions`, with a single key - an empty string (`""`). The corresponding value should be the function `x => x`. - -# --hints-- - -See description above for instructions. - -```js -assert(spreadsheetFunctions['']('x') === 'x'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-025.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-025.md deleted file mode 100644 index f568ad3feb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-025.md +++ /dev/null @@ -1,118 +0,0 @@ ---- -id: 5d7925346f4f2da6df4354a6 -title: Part 25 -challengeType: 0 -dashedName: part-25 ---- - -# --description-- - -Define an empty function `applyFn` which takes an argument `str`. Use the curly brace syntax with an anonymous function. Do not wrap parentheses around the parameter. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('constapplyFn=str=>{}')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-026.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-026.md deleted file mode 100644 index 8a2bfc2bc6..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-026.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -id: 5d792534cac2dbe0a719ea7a -title: Part 26 -challengeType: 0 -dashedName: part-26 ---- - -# --description-- - -Set `noHigh` to `highPrecedence(str)` in `applyFn`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('constapplyFn=str=>{constnoHigh=highPrecedence(str)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-027.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-027.md deleted file mode 100644 index 34bc2b288d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-027.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -id: 5d792534857332d07ccba3ad -title: Part 27 -challengeType: 0 -dashedName: part-27 ---- - -# --description-- - -Set `infix` to `/([0-9.]+)([+-])([0-9.]+)/` in `applyFn`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constapplyFn=str=>{constnoHigh=highPrecedence(str);constinfix=/([0-9.]+)([+-])([0-9.]+)/' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-028.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-028.md deleted file mode 100644 index 2e5c445af1..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-028.md +++ /dev/null @@ -1,131 +0,0 @@ ---- -id: 5d792534d586ef495ea9df90 -title: Part 28 -challengeType: 0 -dashedName: part-28 ---- - -# --description-- - -Set `str2` to `infixEval(noHigh, infix)`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constapplyFn=str=>{constnoHigh=highPrecedence(str);constinfix=/([0-9.]+)([+-])([0-9.]+)/;conststr2=infixEval(noHigh,infix)' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-029.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-029.md deleted file mode 100644 index c151c5f91b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-029.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -id: 5d79253410532e13d13fe574 -title: Part 29 -challengeType: 0 -dashedName: part-29 ---- - -# --description-- - -Set `regex` to `/([a-z]*)\(([0-9., ]*)\)(?!.*\()/i` in `applyFn`. - -# --hints-- - -See description above for instructions. - -```js -assert( - applyFn - .toString() - .replace(/\s/g, '') - .includes('varregex=/([a-z]*)\\(([0-9.,]*)\\)(?!.*\\()/i') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-030.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-030.md deleted file mode 100644 index 6c0b270973..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-030.md +++ /dev/null @@ -1,136 +0,0 @@ ---- -id: 5d7925342415527083bd6667 -title: Part 30 -challengeType: 0 -dashedName: part-30 ---- - -# --description-- - -The `split` method returns an array of strings from a larger string by using its argument to determine where to make each split: - -```js -"a b c".split(" "); // ["a", "b", "c"]; -``` - -Add a function `toNumberList` (inside `applyFn`) which takes an argument `args` and splits it by commas. Return `toNumberList`. - -# --hints-- - -See description above for instructions. - -```js -assert(JSON.stringify(applyFn('')('foo,baz,bar')) === '["foo","baz","bar"]'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-031.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-031.md deleted file mode 100644 index 5496e05313..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-031.md +++ /dev/null @@ -1,140 +0,0 @@ ---- -id: 5d792534c3d26890ac1484d4 -title: Part 31 -challengeType: 0 -dashedName: part-31 ---- - -# --description-- - -The `map` method takes a function and for each element of an array, it passes the element to the function and replace the element with the return value: - -```js -[1, 2, 3].map(x => x + 1); // [2, 3, 4] -``` - -In `toNumberList`, chain the `map` method to `args.split(",")` and pass it `parseFloat` to parse each element of the array into a number. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('consttoNumberList=args=>args.split(",").map(parseFloat)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-032.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-032.md deleted file mode 100644 index 0ebf9a35f9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-032.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -id: 5d792534b92f3d1cd4410ce3 -title: Part 32 -challengeType: 0 -dashedName: part-32 ---- - -# --description-- - -Define a new function `applyFunction` (inside `applyFn`). It should take two arguments: `fn` and `args`, and should return `spreadsheetFunctions`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'consttoNumberList=args=>args.split(",").map(parseFloat);constapplyFunction=(fn,args)=>spreadsheetFunctions' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-033.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-033.md deleted file mode 100644 index cf487c21e0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-033.md +++ /dev/null @@ -1,138 +0,0 @@ ---- -id: 5d7925341193948dfe6d76b4 -title: Part 33 -challengeType: 0 -dashedName: part-33 ---- - -# --description-- - -Now, instead of returning `spreadsheetFunctions`, use bracket notation and `fn.toLowerCase()` to get a specific function from `spreadsheetFunctions`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'consttoNumberList=args=>args.split(",").map(parseFloat);constapplyFunction=(fn,args)=>spreadsheetFunctions[fn.toLowerCase()]' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-034.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-034.md deleted file mode 100644 index 67d0591b16..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-034.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -id: 5d792534cf81365cfca58794 -title: Part 34 -challengeType: 0 -dashedName: part-34 ---- - -# --description-- - -Apply `toNumberList(args)` to `spreadsheetFunctions[fn.toLowerCase()]`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'consttoNumberList=args=>args.split(",").map(parseFloat);constapplyFunction=(fn,args)=>spreadsheetFunctions[fn.toLowerCase()](toNumberList(args))' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-035.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-035.md deleted file mode 100644 index 7ec1032c24..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-035.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -id: 5d7925348ee084278ff15556 -title: Part 35 -challengeType: 0 -dashedName: part-35 ---- - -# --description-- - -Note that `applyFunction` can access `toNumberList` from outside of itself. This is called lexical scoping - inner functions can access variables from outer functions. - -Now return `str2.replace(regex, "")` at the end of `applyFn`. - -# --hints-- - -See description above for instructions. - -```js -assert(applyFn('2*2fn(1, 2, 3.3)') === '4'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-036.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-036.md deleted file mode 100644 index 14f81423a7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-036.md +++ /dev/null @@ -1,140 +0,0 @@ ---- -id: 5d7925348a6a41c32f7a4e3e -title: Part 36 -challengeType: 0 -dashedName: part-36 ---- - -# --description-- - -Replace the `""` in `str2.replace(regex, "")` with a function which takes `match`, `fn` and `args` as arguments and returns `spreadsheetFunctions`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('returnstr2.replace(regex,(match,fn,args)=>spreadsheetFunctions)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-037.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-037.md deleted file mode 100644 index e96d38723a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-037.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -id: 5d792534408c5be896b0a46e -title: Part 37 -challengeType: 0 -dashedName: part-37 ---- - -# --description-- - -The `hasOwnProperty` method checks if a key exists in an object. So `spreadsheetFunctions.hasOwnProperty("")` would return `true`, but replacing `""` with anything else would make it return `false`. - -Chain `hasOwnProperty` to `spreadsheetFunctions` to check if the `fn.toLowerCase()` key exists in `spreadsheetFunctions`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'returnstr2.replace(regex,(match,fn,args)=>spreadsheetFunctions.hasOwnProperty(fn.toLowerCase()))' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-038.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-038.md deleted file mode 100644 index 910fe39b53..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-038.md +++ /dev/null @@ -1,144 +0,0 @@ ---- -id: 5d792534f0eda837510e9192 -title: Part 38 -challengeType: 0 -dashedName: part-38 ---- - -# --description-- - -Now use the ternary operator in the last line to return `applyFunction(fn, args)` if the statement is true, and `match` otherwise. - -# --hints-- - -See description above for instructions. - -```js -assert(applyFn('2+2*2') === '6' && applyFn('(2+2)*2') === '4*2'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-039.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-039.md deleted file mode 100644 index e8ddd4a988..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-039.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -id: 5d7925346b911fce161febaf -title: Part 39 -challengeType: 0 -dashedName: part-39 ---- - -# --description-- - -Now define an empty function `range` which takes `start` and `end` as arguments (define it in the global scope). - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('constrange=(start,end)=>')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-040.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-040.md deleted file mode 100644 index 32c88b8d2b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-040.md +++ /dev/null @@ -1,156 +0,0 @@ ---- -id: 5d79253483eada4dd69258eb -title: Part 40 -challengeType: 0 -dashedName: part-40 ---- - -# --description-- - -`range` should set `arr` to `[start]` and should then return `arr`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').includes('constarr=[start]') && - JSON.stringify(range(1)) === '[1]' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-041.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-041.md deleted file mode 100644 index 843c12b735..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-041.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -id: 5d7925342b2b993ef18cd45f -title: Part 41 -challengeType: 0 -dashedName: part-41 ---- - -# --description-- - -After declaring `arr`, but before returning it, `range` should use the `push` method to add `end` onto `arr`. - -# --hints-- - -See description above for instructions. - -```js -assert(JSON.stringify(range(1, 2)) === '[1,2]' && code.includes('push')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-042.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-042.md deleted file mode 100644 index 9ddaa8e8c4..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-042.md +++ /dev/null @@ -1,168 +0,0 @@ ---- -id: 5d7925341747ad42b12f8e68 -title: Part 42 -challengeType: 0 -dashedName: part-42 ---- - -# --description-- - -This is still valid because we're modifying `arr` in place instead of reassigning to it (which is invalid with the `const` keyword). But doing this still modifies state, and we don't want to do that in functional programming. - -The `concat` method returns a new array instead of modifying an existing one: - -```js -[1,2,3].concat(4); // [1, 2, 3, 4] -[1,2,3].concat(4, 5); // [1, 2, 3, 4, 5] -``` - -Use `concat` instead of `push` to return the result of adding `end` to `arr`. - -# --hints-- - -See description above for instructions. - -```js -assert( - JSON.stringify(range(1, 2)) === '[1,2]' && - code.includes('concat') && - !code.includes('push') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-043.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-043.md deleted file mode 100644 index 9ddf9141d3..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-043.md +++ /dev/null @@ -1,161 +0,0 @@ ---- -id: 5d792535b0b3c198ee3ed6f9 -title: Part 43 -challengeType: 0 -dashedName: part-43 ---- - -# --description-- - -The `concat` method can also accept arrays: - -```js -[1,2,3].concat([4, 5]); // [1, 2, 3, 4, 5] -[1,2,3].concat([4, 5], [6, 7]); // [1, 2, 3, 4, 5, 6, 7] -``` - -Use this form of `concat` by passing an array with just `end` to it: `arr.concat([end])`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('returnarr.concat([end])')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-044.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-044.md deleted file mode 100644 index 4fd31514d2..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-044.md +++ /dev/null @@ -1,156 +0,0 @@ ---- -id: 5d7925357a0533eb221b005d -title: Part 44 -challengeType: 0 -dashedName: part-44 ---- - -# --description-- - -Replace the call to `arr` in `arr.concat([end])` with `[start]` and remove the `arr` variable and its definition. - -# --hints-- - -See description above for instructions. - -```js -assert( - !code.includes('arr') && - code.replace(/\s/g, '').includes('[start].concat([end])') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-045.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-045.md deleted file mode 100644 index b099301946..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-045.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -id: 5d792535591db67ee15b4106 -title: Part 45 -challengeType: 0 -dashedName: part-45 ---- - -# --description-- - -Use the ternary operator to return `[]` if `start > end` and `[start].concat([end])` otherwise. - -# --hints-- - -See description above for instructions. - -```js -assert( - JSON.stringify(range(3, 2)) === '[]' && - JSON.stringify(range(1, 3)) === '[1,3]' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-046.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-046.md deleted file mode 100644 index 44e09a7c9c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-046.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -id: 5d792535f1f7adf77de5831d -title: Part 46 -challengeType: 0 -dashedName: part-46 ---- - -# --description-- - -Replace `[end]` with a recursive call to `range`: `[start].concat(range(start + 1, end))` - -# --hints-- - -See description above for instructions. - -```js -assert(JSON.stringify(range(1, 5)) === '[1,2,3,4,5]'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-047.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-047.md deleted file mode 100644 index c47ac9594f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-047.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -id: 5d7925353d2c505eafd50cd9 -title: Part 47 -challengeType: 0 -dashedName: part-47 ---- - -# --description-- - -Remove the curly braces and `return` keyword from `range`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constrange=(start,end)=>start>end?[]:[start].concat(range(start+1,end))' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-048.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-048.md deleted file mode 100644 index 288bfd4f20..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-048.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -id: 5d79253539b5e944ba3e314c -title: Part 48 -challengeType: 0 -dashedName: part-48 ---- - -# --description-- - -Define a function `charRange` which takes `start` and `end` as arguments. It should return `start`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('constcharRange=(start,end)=>start')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-049.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-049.md deleted file mode 100644 index f04d998459..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-049.md +++ /dev/null @@ -1,154 +0,0 @@ ---- -id: 5d792535a4f1cbff7a8b9a0b -title: Part 49 -challengeType: 0 -dashedName: part-49 ---- - -# --description-- - -Make `charRange` return `range(start, end)`. - -# --hints-- - -See description above for instructions. - -```js -assert(JSON.stringify(charRange(1, 5)) === '[1,2,3,4,5]'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-050.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-050.md deleted file mode 100644 index b8ff79a3c1..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-050.md +++ /dev/null @@ -1,154 +0,0 @@ ---- -id: 5d792535e3304f15a8890162 -title: Part 50 -challengeType: 0 -dashedName: part-50 ---- - -# --description-- - -Use the `charCodeAt(0)` method on `start` and `end` in `charRange`, like this: `start.charCodeAt(0)`. - -# --hints-- - -See description above for instructions. - -```js -assert(JSON.stringify(charRange('A', 'C')) === '[65,66,67]'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-051.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-051.md deleted file mode 100644 index 2c1249ec71..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-051.md +++ /dev/null @@ -1,158 +0,0 @@ ---- -id: 5d792535a40ea5ac549d6804 -title: Part 51 -challengeType: 0 -dashedName: part-51 ---- - -# --description-- - -Chain `map` onto `range(start.charCodeAt(0), end.charCodeAt(0))`, with `x => x` as the argument. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('range(start.charCodeAt(0),end.charCodeAt(0)).map(x=>x)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-052.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-052.md deleted file mode 100644 index 8040420634..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-052.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -id: 5d7925358c220e5b2998909e -title: Part 52 -challengeType: 0 -dashedName: part-52 ---- - -# --description-- - -Now, pass `x` to `String.fromCharCode` in the arrow function. - -# --hints-- - -See description above for instructions. - -```js -assert(JSON.stringify(charRange('A', 'C')) === '["A","B","C"]'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-053.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-053.md deleted file mode 100644 index bf05e022cb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-053.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -id: 5d7925357729e183a49498aa -title: Part 53 -challengeType: 0 -dashedName: part-53 ---- - -# --description-- - -Create a new function `evalFormula` which takes a single argument, `x`. Set `/([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi` to a variable named `rangeRegex`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constevalFormula=x=>{constrangeRegex=/([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-054.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-054.md deleted file mode 100644 index ccb38b4bed..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-054.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -id: 5d79253555aa652afbb68086 -title: Part 54 -challengeType: 0 -dashedName: part-54 ---- - -# --description-- - -Define a function `rangeFromString` in `evalFormula` which takes `n1` and `n2` as arguments and returns `n1`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /evalFormula.*constrangeFromString=\(n1,n2\)=>n1/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-055.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-055.md deleted file mode 100644 index 71fc1817d8..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-055.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -id: 5d79253582be306d339564f6 -title: Part 55 -challengeType: 0 -dashedName: part-55 ---- - -# --description-- - -Replace the `n1` return value in `rangeFromString` with `range(n1, n2)`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /evalFormula.*constrangeFromString=\(n1,n2\)=>range\(n1,n2\)/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-056.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-056.md deleted file mode 100644 index 49dc821958..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-056.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -id: 5d7925352047e5c54882c436 -title: Part 56 -challengeType: 0 -dashedName: part-56 ---- - -# --description-- - -As `n1` and `n2` are actually strings, replace `n1` and `n2` with `parseInt(n1)` and `parseInt(n2)`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /evalFormula.*constrangeFromString=\(n1,n2\)=>range\(parseInt\(n1\),parseInt\(n2\)\)/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-057.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-057.md deleted file mode 100644 index 0156dce11a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-057.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -id: 5d79253568e441c0adf9db9f -title: Part 57 -challengeType: 0 -dashedName: part-57 ---- - -# --description-- - -Now define a function `elemValue`, which takes an argument `n` and returns `n`. Use the curly brace arrow function syntax. - -# --hints-- - -See description above for instructions. - -```js -assert( - /evalFormula.*constelemValue=n=>\{returnn;?\}/.test(code.replace(/\s/g, '')) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-058.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-058.md deleted file mode 100644 index c3d88365c9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-058.md +++ /dev/null @@ -1,181 +0,0 @@ ---- -id: 5d7925356ab117923b80c9cd -title: Part 58 -challengeType: 0 -dashedName: part-58 ---- - -# --description-- - -Inside `elemValue`, define `fn` to be a function which takes `c` as argument and returns `document.getElementById(c + n).value`. Return `fn` instead of `n`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /elemValue.*constfn=\(?c\)?=>document\.getElementById\(c\+n\)\.value;?returnfn;?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-059.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-059.md deleted file mode 100644 index 90717f38f7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-059.md +++ /dev/null @@ -1,181 +0,0 @@ ---- -id: 5d792535e54a8cd729a0d708 -title: Part 59 -challengeType: 0 -dashedName: part-59 ---- - -# --description-- - -Now define `fn` to be `elemValue("1")` (inside `evalFormula` but outside `elemValue`). As `elemValue` returns a function, `fn` is also a function. - -# --hints-- - -See description above for instructions. - -```js -assert( - /elemValue.*constfn=elemValue\(['"]1['"]\);?\}/.test(code.replace(/\s/g, '')) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-060.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-060.md deleted file mode 100644 index c640a7157d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-060.md +++ /dev/null @@ -1,185 +0,0 @@ ---- -id: 5d7925353b307724a462b06b -title: Part 60 -challengeType: 0 -dashedName: part-60 ---- - -# --description-- - -Finally, return `fn("A")`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /elemValue.*constfn=elemValue\(['"]1['"]\);?returnfn\(['"]A['"]\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-061.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-061.md deleted file mode 100644 index dcda220719..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-061.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -id: 5d792536735f71d746ee5d99 -title: Part 61 -challengeType: 0 -dashedName: part-61 ---- - -# --description-- - -You might think that this wouldn't work because `fn` wouldn't have access to `n` after `elemValue` has finished executing. However, this works because of closures - functions have access to all variables declared at their time of creation. - -Inside `elemValue`, remove the variable `fn` and its definition, and replace `return fn` with `return c => document.getElementById(c + n).value`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('constelemValue=n=>{returnc=>document.getElementById(c+n).value') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-062.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-062.md deleted file mode 100644 index 4688244267..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-062.md +++ /dev/null @@ -1,182 +0,0 @@ ---- -id: 5d792536ad340d9dff2e4a96 -title: Part 62 -challengeType: 0 -dashedName: part-62 ---- - -# --description-- - -Now, remove the curly braces and return statement. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constelemValue=n=>\(?c=>document\.getElementById\(c\+n\)\.value/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-063.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-063.md deleted file mode 100644 index 1591ad51d1..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-063.md +++ /dev/null @@ -1,181 +0,0 @@ ---- -id: 5d7925369614afd92d01fed5 -title: Part 63 -challengeType: 0 -dashedName: part-63 ---- - -# --description-- - -You also don't need the parentheses in `elemValue` - it's parsed this way automatically. Remove them. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constelemValue=n=>c=>document\.getElementById\(c\+n\)\.value/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-064.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-064.md deleted file mode 100644 index fcadae3262..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-064.md +++ /dev/null @@ -1,180 +0,0 @@ ---- -id: 5d792536504e68254fe02236 -title: Part 64 -challengeType: 0 -dashedName: part-64 ---- - -# --description-- - -The technique we just used is called currying - instead of taking multiple arguments, a function takes a single argument and return another function, which also takes a single argument. - -Define a new curried function, `addChars`, and set it equal to `c1 => c2 => c1 + c2`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('constaddChars=c1=>c2=>c1+c2')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-065.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-065.md deleted file mode 100644 index 5f1361ce97..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-065.md +++ /dev/null @@ -1,184 +0,0 @@ ---- -id: 5d792536c8d2f0fdfad768fe -title: Part 65 -challengeType: 0 -dashedName: part-65 ---- - -# --description-- - -You can add more arguments by simply adding another arrow with another argument name: - -```js -const manyArguments = a => b => c => d => [a, b, c, d] -``` - -Add another argument to `addChars` and add it to the sum: `c1 => c2 => n => c1 + c2 + n`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('constaddChars=c1=>c2=>n=>c1+c2+n')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-066.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-066.md deleted file mode 100644 index ed6ce2aece..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-066.md +++ /dev/null @@ -1,180 +0,0 @@ ---- -id: 5d79253639028b8ec56afcda -title: Part 66 -challengeType: 0 -dashedName: part-66 ---- - -# --description-- - -Replace the body of `addChars`, so that instead of adding the arguments, it returns a `charRange` between the first two arguments: `c1 => c2 => n => charRange(c1, c2)`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').includes('constaddChars=c1=>c2=>n=>charRange(c1,c2)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-067.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-067.md deleted file mode 100644 index 002ac9edb4..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-067.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -id: 5d792536834f2fd93e84944f -title: Part 67 -challengeType: 0 -dashedName: part-67 ---- - -# --description-- - -You call curried functions like this: - -```js -const result = add(1)(2); -``` - -Use `map` on the `charRange` in `addChars`, passing in `x => elemValue(n)(x)` as the argument. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constaddChars=c1=>c2=>n=>charRange(c1,c2).map(x=>elemValue(n)(x))' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-068.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-068.md deleted file mode 100644 index 34db17da4a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-068.md +++ /dev/null @@ -1,184 +0,0 @@ ---- -id: 5d792536ddff9ea73c90a994 -title: Part 68 -challengeType: 0 -dashedName: part-68 ---- - -# --description-- - -However, you don't need an arrow function. As `elemValue(n)` is a function, you can pass it to `map` directly. - -Change `x => elemValue(n)(x)` to `elemValue(n)`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('constaddChars=c1=>c2=>n=>charRange(c1,c2).map(elemValue(n))') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-069.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-069.md deleted file mode 100644 index b8e784be5e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-069.md +++ /dev/null @@ -1,182 +0,0 @@ ---- -id: 5d7925361596f84067904f7f -title: Part 69 -challengeType: 0 -dashedName: part-69 ---- - -# --description-- - -Remove the `fn` declaration and return statement. Set `varRangeExpanded` to the result of using the `replace` method on `x`, with `rangeRegex` as the first argument and `""` as the second argument. Then, return it. - -# --hints-- - -See description above for instructions. - -```js -assert( - !code.includes('const fn') && - code.includes('varRangeExpanded') && - evalFormula('A1:J133') === '3' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-070.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-070.md deleted file mode 100644 index 68526cac21..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-070.md +++ /dev/null @@ -1,186 +0,0 @@ ---- -id: 5d792536dd8a4daf255488ac -title: Part 70 -challengeType: 0 -dashedName: part-70 ---- - -# --description-- - -Replace the `""` in `varRangeExpanded` with a function, which takes `match`, `c1`, `n1`, `c2` and `n2` as arguments, and returns `n1`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constvarRangeExpanded=x.replace(rangeRegex,(match,c1,n1,c2,n2)=>n1)' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-071.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-071.md deleted file mode 100644 index ab3dcf48bb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-071.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -id: 5d792536449c73004f265fb1 -title: Part 71 -challengeType: 0 -dashedName: part-71 ---- - -# --description-- - -Replace the `n1` return value in `varRangeExpanded` with `rangeFromString(n1, n2)`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constvarRangeExpanded=x.replace(rangeRegex,(match,c1,n1,c2,n2)=>rangeFromString(n1,n2))' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-072.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-072.md deleted file mode 100644 index b80a304f66..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-072.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -id: 5d79253685fc69b8fe60a0d2 -title: Part 72 -challengeType: 0 -dashedName: part-72 ---- - -# --description-- - -Chain the `map` method to `rangeFromString(n1, n2)` and pass it `addChars(c1)(c2)` as an argument. - -This returns an `addChars` function, which has `c1` and `c2` (the characters) preset, and only needs a number (`n`) to be passed to it (which we get from the `rangeFromString` array). - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constvarRangeExpanded=x.replace(rangeRegex,(match,c1,n1,c2,n2)=>rangeFromString(n1,n2).map(addChars(c1)(c2)))' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-073.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-073.md deleted file mode 100644 index fff03229b8..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-073.md +++ /dev/null @@ -1,186 +0,0 @@ ---- -id: 5d792536dc6e3ab29525de9e -title: Part 73 -challengeType: 0 -dashedName: part-73 ---- - -# --description-- - -The function in `varRangeExpanded` contains an unused argument. Replace or prefix it with an underscore. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('constvarRangeExpanded=x.replace(rangeRegex,(_') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-074.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-074.md deleted file mode 100644 index 5c4dc2d246..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-074.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -id: 5d792536cfd0fd893c630abb -title: Part 74 -challengeType: 0 -dashedName: part-74 ---- - -# --description-- - -Set `varRegex` to `/[A-J][1-9][0-9]?/gi`. Then set `varExpanded` to the result of replacing `varRegex` with an empty string in `varRangeExpanded`. Return `varExpanded`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.includes('varRegex') && - code.includes('varExpanded') && - evalFormula('aC12bc') === 'abc' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-075.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-075.md deleted file mode 100644 index 1f391b442e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-075.md +++ /dev/null @@ -1,195 +0,0 @@ ---- -id: 5d7925366a5ff428fb483b40 -title: Part 75 -challengeType: 0 -dashedName: part-75 ---- - -# --description-- - -Replace the `""` in `varExpanded` with `match => document.getElementById(match.toUpperCase()).value`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constvarExpanded=varRangeExpanded.replace(varRegex,match=>document.getElementById(match.toUpperCase()).value)' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-076.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-076.md deleted file mode 100644 index 891d4a5da5..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-076.md +++ /dev/null @@ -1,193 +0,0 @@ ---- -id: 5d7925365d4035eeb2e395fd -title: Part 76 -challengeType: 0 -dashedName: part-76 ---- - -# --description-- - -Set `functionExpanded` to `applyFn(varExpanded)` in `evalFormula`. Return `functionExpanded`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.includes('functionExpanded') && applyFn('2+2') === '4'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-077.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-077.md deleted file mode 100644 index 5bb94f0fc4..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-077.md +++ /dev/null @@ -1,198 +0,0 @@ ---- -id: 5d7925364c106e9aaf05a16f -title: Part 77 -challengeType: 0 -dashedName: part-77 ---- - -# --description-- - -`evalFormula` should return the value passed to it if this value remained unchanged. Otherwise, it should call itself with the latest value. - -Use the ternary operator in the last line of `evalFormula` to return `functionExpanded` if `x === functionExpanded` and `evalFormula(functionExpanded)` otherwise. - -# --hints-- - -See description above for instructions. - -```js -assert(evalFormula('(2+2)*2') === '8'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-078.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-078.md deleted file mode 100644 index 9247a03aec..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-078.md +++ /dev/null @@ -1,206 +0,0 @@ ---- -id: 5d792536970cd8e819cc8a96 -title: Part 78 -challengeType: 0 -dashedName: part-78 ---- - -# --description-- - -You can define arrow functions without arguments: - -```js -const two = () => 2; -``` - -Define an empty arrow function without arguments and assign it to `window.onload`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('window.onload=()=>')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-079.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-079.md deleted file mode 100644 index 35d843ba73..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-079.md +++ /dev/null @@ -1,209 +0,0 @@ ---- -id: 5d792536e33baeaa60129e0a -title: Part 79 -challengeType: 0 -dashedName: part-79 ---- - -# --description-- - -In `window.onload`, assign `document.getElementById("container")` to `container`. Also assign `charRange("A", "J")` to `letters`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /window\.onload=\(\)=>\{constcontainer=document\.getElementById\(["']container["']\);?constletters=charRange\(["']A["'],["']J["']\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-080.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-080.md deleted file mode 100644 index 151b312b28..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-080.md +++ /dev/null @@ -1,215 +0,0 @@ ---- -id: 5d7925379e2a488f333e2d43 -title: Part 80 -challengeType: 0 -dashedName: part-80 ---- - -# --description-- - -Now define a function `createLabel` which takes an argument `name` and has an empty body. - -# --hints-- - -See description above for instructions. - -```js -assert( - /window\.onload[\s\S]*constcreateLabel=\(?name\)?=>\{\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-081.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-081.md deleted file mode 100644 index 9c02544fa7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-081.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -id: 5d7925379000785f6d8d9af3 -title: Part 81 -challengeType: 0 -dashedName: part-81 ---- - -# --description-- - -Inside `createLabel`, assign `document.createElement("div")` to `label`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /window\.onload[\s\S]*constcreateLabel=\(?name\)?=>\{constlabel=document\.createElement\(["']div["']\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-082.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-082.md deleted file mode 100644 index 73130f37af..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-082.md +++ /dev/null @@ -1,227 +0,0 @@ ---- -id: 5d79253791391b0acddd0ac5 -title: Part 82 -challengeType: 0 -dashedName: part-82 ---- - -# --description-- - -Add the following code to `createLabel`: - -```js -label.className = "label"; -label.textContent = name; -container.appendChild(label); -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - /window\.onload[\s\S]*constcreateLabel=\(?name\)?=>\{constlabel=document\.createElement\(["']div["']\);?label\.className=["']label["'];?label\.textContent=name;?container\.appendChild\(label\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-083.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-083.md deleted file mode 100644 index 2696ccf13a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-083.md +++ /dev/null @@ -1,223 +0,0 @@ ---- -id: 5d7925373104ae5ae83f20a5 -title: Part 83 -challengeType: 0 -dashedName: part-83 ---- - -# --description-- - -The `forEach` method takes a function and calls it with each element of the array. - -Chain `forEach` to `letters` and pass it the `createLabel` function to create a label for each of the letters. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('letters.forEach(createLabel)')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-084.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-084.md deleted file mode 100644 index 616f9e9eef..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-084.md +++ /dev/null @@ -1,223 +0,0 @@ ---- -id: 5d7925373b7127cfaeb50c26 -title: Part 84 -challengeType: 0 -dashedName: part-84 ---- - -# --description-- - -Add `range(1, 99)` to the end of `window.onload` (the result will be discarded for now). - -# --hints-- - -See description above for instructions. - -```js -assert(/window\.onload[\s\S]*range\(1,99\);?\}/.test(code.replace(/\s/g, ''))); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-085.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-085.md deleted file mode 100644 index b7e36eaffc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-085.md +++ /dev/null @@ -1,228 +0,0 @@ ---- -id: 5d792537cb3a5cd6baca5e1a -title: Part 85 -challengeType: 0 -dashedName: part-85 ---- - -# --description-- - -Chain `forEach` onto `range(1, 99)`, passing in `createLabel` as an argument. - -# --hints-- - -See description above for instructions. - -```js -assert( - /window\.onload[\s\S]*range\(1,99\)\.forEach\(createLabel\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-086.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-086.md deleted file mode 100644 index 4fcb97a978..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-086.md +++ /dev/null @@ -1,230 +0,0 @@ ---- -id: 5d79253742f3313d55db981f -title: Part 86 -challengeType: 0 -dashedName: part-86 ---- - -# --description-- - -Replace `createLabel` with an arrow function with a block body. This would allow us to add more statements. The arrow function should take an argument `x`, and call `createLabel(x)`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /window\.onload[\s\S]*range\(1,99\)\.forEach\(\(?x\)?=>\{createLabel\(x\);?\}\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-087.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-087.md deleted file mode 100644 index 5f58399a0c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-087.md +++ /dev/null @@ -1,235 +0,0 @@ ---- -id: 5d7925379e0180a438ce7f95 -title: Part 87 -challengeType: 0 -dashedName: part-87 ---- - -# --description-- - -Inside the `range` `forEach`, use the `forEach` method on `letters`, passing in a function with argument `x` and an empty body. - -# --hints-- - -See description above for instructions. - -```js -assert( - /window\.onload.*range\(1,99\)\.forEach\(\(?x\)?=>\{createLabel\(x\);?letters\.forEach\(\(?y\)?=>\{\}\);?\}\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-088.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-088.md deleted file mode 100644 index 2c508883bc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-088.md +++ /dev/null @@ -1,238 +0,0 @@ ---- -id: 5d792537c80984dfa5501b96 -title: Part 88 -challengeType: 0 -dashedName: part-88 ---- - -# --description-- - -Inside `letters.forEach`, assign `document.createElement("input")` to `input`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /window\.onload[\s\S]*range\(1,99\)\.forEach\(\(?x\)?=>\{createLabel\(x\);?letters\.forEach\(\(?y\)?=>\{constinput=document\.createElement\(["']input["']\);?\}\);?\}\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-089.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-089.md deleted file mode 100644 index 3e7d194a12..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-089.md +++ /dev/null @@ -1,249 +0,0 @@ ---- -id: 5d7925377b54d8a76efb5657 -title: Part 89 -challengeType: 0 -dashedName: part-89 ---- - -# --description-- - -Add the following code to `letters.forEach`: - -```js -input.type = "text"; -input.id = y + x; -input.onchange = update; -container.appendChild(input); -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - /window\.onload[\s\S]*range\(1,99\)\.forEach\(\(?x\)?=>\{createLabel\(x\);?letters\.forEach\(\(?y\)?=>\{constinput=document\.createElement\(["']input["']\);?input\.type=["']text["'];?input\.id=y\+x;?input\.onchange=update;?container\.appendChild\(input\);?\}\);?\}\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-090.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-090.md deleted file mode 100644 index 6a62000c17..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-090.md +++ /dev/null @@ -1,250 +0,0 @@ ---- -id: 5d7925371398513549bb6395 -title: Part 90 -challengeType: 0 -dashedName: part-90 ---- - -# --description-- - -In the global scope, define a function called `update` which takes `event` as argument. It should define a variable, `element`, setting it to `event.target`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constupdate=\(?event\)?=>\{?constelement=event\.target;?\}?/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-091.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-091.md deleted file mode 100644 index faf192a0ff..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-091.md +++ /dev/null @@ -1,255 +0,0 @@ ---- -id: 5d792537ea3eaf302bf2d359 -title: Part 91 -challengeType: 0 -dashedName: part-91 ---- - -# --description-- - -Now set `value` to `element.value.replace(/\s/g, "")`. This removes all whitespace from `element` so that we can ignore it. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constupdate=\(?event\)?=>\{constelement=event\.target;?constvalue=element\.value\.replace\(\/\\s\/g,["']{2}\);?\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-092.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-092.md deleted file mode 100644 index 4ec531ba10..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-092.md +++ /dev/null @@ -1,259 +0,0 @@ ---- -id: 5d792537533b1c7843bfd029 -title: Part 92 -challengeType: 0 -dashedName: part-92 ---- - -# --description-- - -The `includes` method works on a string and checks if the argument is its substring. - -Add an empty if statement to `update` which executes if `element.id` is **not** a substring of `value`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constupdate=\(?event\)?=>\{constelement=event\.target;?constvalue=element\.value\.replace\(\/\\s\/g,["']{2}\);?if\(!\(?value\.includes\(element\.id\)\)?\)\{\}\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-093.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-093.md deleted file mode 100644 index fb6bff3d44..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-093.md +++ /dev/null @@ -1,258 +0,0 @@ ---- -id: 5d792537dc0fe84345d4f19e -title: Part 93 -challengeType: 0 -dashedName: part-93 ---- - -# --description-- - -Add another condition to the if statement so that it only executes if the first character of `value` is `=`. Do this by adding `&& value[0] === "="` to the if statement. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constupdate=\(?event\)?=>\{constelement=event\.target;?constvalue=element\.value\.replace\(\/\\s\/g,["']{2}\);?if\(!\(?value\.includes\(element\.id\)\)?&&value\[0\]===["']=["']\)\{\}\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-094.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-094.md deleted file mode 100644 index 7a28fe467f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-094.md +++ /dev/null @@ -1,258 +0,0 @@ ---- -id: 5d792537b6cadae0f4b0cda1 -title: Part 94 -challengeType: 0 -dashedName: part-94 ---- - -# --description-- - -The `slice` method takes two arguments. It extracts characters from the string from the index specified by the first argument up to (but not including) the second argument. The index starts at 0. - -Use the `slice` method to log the first two letters of `value` to the console. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('console.log(value.slice(0,2))')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-095.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-095.md deleted file mode 100644 index c40d4d980a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-095.md +++ /dev/null @@ -1,260 +0,0 @@ ---- -id: 5d79253770083fb730c93a93 -title: Part 95 -challengeType: 0 -dashedName: part-95 ---- - -# --description-- - -You don't have to specify the second argument in `slice`. If you don't, then `slice` will extract from the first argument to the end of the string. - -Change the call to `slice` to log all characters except the first instead. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('console.log(value.slice(1))')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-096.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-096.md deleted file mode 100644 index bb8ebca7b9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-096.md +++ /dev/null @@ -1,264 +0,0 @@ ---- -id: 5d792537fef76b226b63b93b -title: Part 96 -challengeType: 0 -dashedName: part-96 ---- - -# --description-- - -Now change the if statement to set `element.value` to the result of passing `value.slice(1)` to `evalFormula`. There is no need to use `const` because we're modifying `element.value`, not declaring it. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constupdate=\(?event\)?=>\{constelement=event\.target;?constvalue=element\.value\.replace\(\/\\s\/g,["']{2}\);?if\(!\(?value\.includes\(element\.id\)\)?&&value\[0\]===["']=["']\)\{element\.value=evalFormula\(value\.slice\(1\)\);?\}\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-097.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-097.md deleted file mode 100644 index d4603ffabc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-097.md +++ /dev/null @@ -1,271 +0,0 @@ ---- -id: 5d79253760fca25ccbbd8990 -title: Part 97 -challengeType: 0 -dashedName: part-97 ---- - -# --description-- - -The array destructuring syntax can be used to extract values from arrays: - -```js -const [x, y] = [1, 2]; // in variables -const fn = ([x, y]) => x + y // in functions -``` - -Use this syntax to define a function `random` in `spreadsheetFunctions` which takes the array `[x, y]` and returns `x`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /["']?random["']?:\(\[x,y\]\)=>x/.test(code.replace(/\s/g, '')) && - spreadsheetFunctions['random']([1, 2]) === 1 -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-098.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-098.md deleted file mode 100644 index f7d670d94d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-098.md +++ /dev/null @@ -1,265 +0,0 @@ ---- -id: 5d7925374321824cba309875 -title: Part 98 -challengeType: 0 -dashedName: part-98 ---- - -# --description-- - -Change the `random` function so that it returns `Math.floor(Math.random() * y + x)`. It now returns a random number within a range. - -# --hints-- - -See description above for instructions. - -```js -assert( - /["']?random["']?:\(\[x,y\]\)=>Math\.floor\(Math\.random\(\)\*y\+x\)/.test( - code.replace(/\s/g, '') - ) && spreadsheetFunctions['random']([1, 1]) === 1 -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-099.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-099.md deleted file mode 100644 index 261e0347ad..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-099.md +++ /dev/null @@ -1,274 +0,0 @@ ---- -id: 5d7925381e8565a5c50ba7f1 -title: Part 99 -challengeType: 0 -dashedName: part-99 ---- - -# --description-- - -In functional programming, we strive to use a type of function called "pure functions" as much as possible. The first property of pure functions is that they always return the same value for the same arguments. - -You can check if this is the case by comparing a call to a function with another call (with the same arguments): - -```js -console.log(f(2) === f(2)); // always true for pure functions -``` - -Use this technique to check if the `random` function in `spreadsheetFunctions` is pure by passing in the following array: `[1, 1000]`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /(spreadsheetFunctions\[["']random["']\]\(1,1000\))===\1/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-100.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-100.md deleted file mode 100644 index 2774488c54..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-100.md +++ /dev/null @@ -1,269 +0,0 @@ ---- -id: 5d7925383f1b77db7f1ff59e -title: Part 100 -challengeType: 0 -dashedName: part-100 ---- - -# --description-- - -This is (probably) false, so `random` is certainly impure. - -The second property of pure functions is that they perform no side effects, which are state and I/O modifications. If you call a function without assigning the result to a variable, and it does something, then it's an impure function. - -Call `window.onload()` in `update`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /update=\(?event\)?=>\{.*window\.onload\(\).*\}/.test(code.replace(/\s/g, '')) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-101.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-101.md deleted file mode 100644 index 55429a76f9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-101.md +++ /dev/null @@ -1,266 +0,0 @@ ---- -id: 5d792538de9fa3f298bcd5f6 -title: Part 101 -challengeType: 0 -dashedName: part-101 ---- - -# --description-- - -Now try calling `highPrecedence` and pass it the string `"2*2"` without assigning it to a variable in `update`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /update=\(?event\)?=>\{.*highPrecedence\((['"])2\*2\1\).*\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-102.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-102.md deleted file mode 100644 index 056a6ffaf1..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-102.md +++ /dev/null @@ -1,268 +0,0 @@ ---- -id: 5d7925385b74f69642e1fea5 -title: Part 102 -challengeType: 0 -dashedName: part-102 ---- - -# --description-- - -Obviously, this was ignored, as all `highPrecedence` does is return a value and this value is ignored. - -Now compare `highPrecedence("2*2")` with `highPrecedence("2*2")`, and `console.log` the result. - -# --hints-- - -See description above for instructions. - -```js -assert( - /update=\(?event\)?=>\{.*console\.log\((highPrecedence\(['"]2\*2['"]\))===\1\).*\}/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-103.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-103.md deleted file mode 100644 index 12dce03c77..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-103.md +++ /dev/null @@ -1,263 +0,0 @@ ---- -id: 5d7925380ea76d55b2c97d7b -title: Part 103 -challengeType: 0 -dashedName: part-103 ---- - -# --description-- - -This is true, so `highPrecedence` might be a pure function. If you inspect it, you can see that it indeed performs no I/O and doesn't use functions like `Math.random()` - so it's pure. - -Remove the `console.log` statement. - -# --hints-- - -See description above for instructions. - -```js -assert(!code.includes('console.log')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-104.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-104.md deleted file mode 100644 index c6d66c4b42..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-104.md +++ /dev/null @@ -1,265 +0,0 @@ ---- -id: 5d792538be4fe331f1a6c008 -title: Part 104 -challengeType: 0 -dashedName: part-104 ---- - -# --description-- - -Unfortunately, impure functions are necessary - if you don't use them, the application won't perform any I/O so won't do anything. - -But we have an impure function that could be pure - `evalFormula`. It calls `document.getElementById(c + n).value`, but this value can change, even if the arguments don't. - -Change these calls to `""` - the function is now pure but doesn't work. - -# --hints-- - -See description above for instructions. - -```js -const nos = code.replace(/\s/g, ''); -assert(nos.includes('elemValue=n=>c=>""') && nos.includes('match=>""')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-105.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-105.md deleted file mode 100644 index 56b0b86f55..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-105.md +++ /dev/null @@ -1,262 +0,0 @@ ---- -id: 5d792538d169f33142175b95 -title: Part 105 -challengeType: 0 -dashedName: part-105 ---- - -# --description-- - -To make this function pure, instead of depending on application state implicitly, we can pass it down explicitly as an argument. - -Add an argument `cells` to `evalFormula`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('evalFormula=(x,cells)=>{')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-106.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-106.md deleted file mode 100644 index 719f380dee..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-106.md +++ /dev/null @@ -1,270 +0,0 @@ ---- -id: 5d792538e48b5a2c6e5bbe12 -title: Part 106 -challengeType: 0 -dashedName: part-106 ---- - -# --description-- - -When calling `evalFormula` in `update`, pass in `Array.from(document.getElementById("container").children)` as the `cells` argument. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'evalFormula(value.slice(1),Array.from(document.getElementById("container").children))' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-107.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-107.md deleted file mode 100644 index 4c60fed38f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-107.md +++ /dev/null @@ -1,266 +0,0 @@ ---- -id: 5d7925387f3e9da5ec856dbe -title: Part 107 -challengeType: 0 -dashedName: part-107 ---- - -# --description-- - -Update the recursive call to `evalFormula` by passing in `cells` as the second argument. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('evalFormula(functionExpanded,cells)')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-108.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-108.md deleted file mode 100644 index 7afc00435c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-108.md +++ /dev/null @@ -1,267 +0,0 @@ ---- -id: 5d79253824ae9b4a6e6f3108 -title: Part 108 -challengeType: 0 -dashedName: part-108 ---- - -# --description-- - -Add a function `idToText` to `evalFormula`, which takes the argument `id` and returns `cells`. - -# --hints-- - -See description above for instructions. - -```js -assert(/constidToText=\(?id\)?=>cells/.test(code.replace(/\s/g, ''))); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-109.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-109.md deleted file mode 100644 index d8de61d2a8..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-109.md +++ /dev/null @@ -1,273 +0,0 @@ ---- -id: 5d7925383f122a279f4c54ad -title: Part 109 -challengeType: 0 -dashedName: part-109 ---- - -# --description-- - -The `find` method returns the first element of an array that satisfies the function passed to it. - -Chain `find` onto `cells` and pass it `cell => cell === id`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constidToText=\(?id\)?=>cells\.find\(\(?cell\)?=>cell===id\)/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-110.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-110.md deleted file mode 100644 index d9cd4ea910..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-110.md +++ /dev/null @@ -1,270 +0,0 @@ ---- -id: 5d7925387b682e962f209269 -title: Part 110 -challengeType: 0 -dashedName: part-110 ---- - -# --description-- - -In `idToText`, use the `id` property of `cell` to make sure the argument is equal to the cell's id rather than the cell itself. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constidToText=\(?id\)?=>cells\.find\(\(?cell\)?=>cell\.id===id\)/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-111.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-111.md deleted file mode 100644 index 6010072093..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-111.md +++ /dev/null @@ -1,270 +0,0 @@ ---- -id: 5d792538de774217b173288e -title: Part 111 -challengeType: 0 -dashedName: part-111 ---- - -# --description-- - -Use the `value` property on the result of `idToText` to return the text inside the cell, rather than the cell itself. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constidToText=\(?id\)?=>cells\.find\(\(?cell\)?=>cell\.id===id\)\.value/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-112.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-112.md deleted file mode 100644 index c9e7086ced..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-112.md +++ /dev/null @@ -1,267 +0,0 @@ ---- -id: 5d79253891d93585323d1f3c -title: Part 112 -challengeType: 0 -dashedName: part-112 ---- - -# --description-- - -Change the empty string in `elemValue` to the result of calling `idToText` with `c + n`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').includes('elemValue=n=>c=>idToText(c+n)')); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-113.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-113.md deleted file mode 100644 index 2060ef06b0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-113.md +++ /dev/null @@ -1,269 +0,0 @@ ---- -id: 5d7925384e34e944ecb4612d -title: Part 113 -challengeType: 0 -dashedName: part-113 ---- - -# --description-- - -Change the empty string in `varExpanded` to the result of calling `idToText` with `match.toUpperCase()`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').includes('match=>idToText(match.toUpperCase())') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-114.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-114.md deleted file mode 100644 index 40978e5993..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-114.md +++ /dev/null @@ -1,271 +0,0 @@ ---- -id: 5d792538631844ad0bdfb4c3 -title: Part 114 -challengeType: 0 -dashedName: part-114 ---- - -# --description-- - -`evalFormula` is now pure, as it now has no external dependencies, and as before, performs no side effects. - -Now define a new function, `increment` inside `spreadsheetFunctions`, which takes `nums` as argument and uses `map` to increment each value of `nums` by 1. - -# --hints-- - -See description above for instructions. - -```js -assert(JSON.stringify(spreadsheetFunctions.increment([1, 5, 3])) === '[2,6,4]'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-115.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-115.md deleted file mode 100644 index e111bcb79b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-115.md +++ /dev/null @@ -1,277 +0,0 @@ ---- -id: 5d792538e2a8d20cc580d481 -title: Part 115 -challengeType: 0 -dashedName: part-115 ---- - -# --description-- - -The `slice` method can also work on arrays. - -Add a method `firsttwo` to `spreadsheetFunctions` which takes `arr` as argument and uses `slice` to return the first two elements of `arr`. - -# --hints-- - -See description above for instructions. - -```js -assert( - JSON.stringify(spreadsheetFunctions.firsttwo([2, 6, 1, 4, 3])) === '[2,6]' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-116.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-116.md deleted file mode 100644 index 13e96fed7a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-116.md +++ /dev/null @@ -1,283 +0,0 @@ ---- -id: 5d792538f5004390d6678554 -title: Part 116 -challengeType: 0 -dashedName: part-116 ---- - -# --description-- - -You can also pass in a negative argument to `slice` to specify that index from the end: - -```js -[2, 4, 6, 8, 10].slice(-3); // [6, 8, 10] -``` - -Use a negative index to add a function `lasttwo` which returns the last two elements of an array. - -# --hints-- - -See description above for instructions. - -```js -assert( - JSON.stringify(spreadsheetFunctions.lasttwo([2, 6, 1, 4, 3])) === '[4,3]' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-117.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-117.md deleted file mode 100644 index 5fb13c0ed6..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-117.md +++ /dev/null @@ -1,286 +0,0 @@ ---- -id: 5d792539dd4fd4c96fd85f7e -title: Part 117 -challengeType: 0 -dashedName: part-117 ---- - -# --description-- - -The `%` operator returns the remainder: - -```js -4 % 3; // 1 -5 % 3; // 2 -6 % 3; // 0 -``` - -Add an `isEven` function (to the global scope) which returns whether the number passed to it is even. - -# --hints-- - -See description above for instructions. - -```js -assert(isEven(20) && !isEven(31)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-118.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-118.md deleted file mode 100644 index 1d587b4bd9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-118.md +++ /dev/null @@ -1,290 +0,0 @@ ---- -id: 5d79253949802f8587c8bbd3 -title: Part 118 -challengeType: 0 -dashedName: part-118 ---- - -# --description-- - -The `filter` method keeps only the elements of an array that satisfy the function passed to it: - -```js -[1, 10, 8, 3, 4, 5].filter(x > 3); // [10, 8, 4, 5] -``` - -Use `filter` to add a function called `even` to `spreadsheetFunctions`, which returns all the even elements of an array, `nums`. - -# --hints-- - -See description above for instructions. - -```js -assert( - JSON.stringify(spreadsheetFunctions.even([2, 3, 5, 6, 9, 4])) === '[2,6,4]' && - code.includes('filter') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-119.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-119.md deleted file mode 100644 index e14a03d3f2..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-119.md +++ /dev/null @@ -1,295 +0,0 @@ ---- -id: 5d7925395888767e9304c082 -title: Part 119 -challengeType: 0 -dashedName: part-119 ---- - -# --description-- - -The `reduce` method takes a function with an accumulator and the current value. The accumulator is initially set to the value at index 0. - -The `reduce` method then goes through each element of the array after that, passing in the element as the current value and the result of the last call as the accumulator. - -For example, here's how to multiply all the value in an array: - -```js -[2, 3, 4].reduce((a, x) => a * x); // 24 -``` - -Using `reduce`, add a function `sum` to `spreadsheetFunctions`, which sums all values in the array passed to it. - -# --hints-- - -See description above for instructions. - -```js -assert( - spreadsheetFunctions.sum([10, 5, 1, 3]) === 19 && code.includes('reduce') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-120.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-120.md deleted file mode 100644 index 404b2270b5..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-120.md +++ /dev/null @@ -1,289 +0,0 @@ ---- -id: 5d7925393b30099e37a34668 -title: Part 120 -challengeType: 0 -dashedName: part-120 ---- - -# --description-- - -The `includes` method checks if an element is in an array. - -Add a `has2` function to `spreadsheetFunctions` which checks if the inputted array has the number 2 in it. - -# --hints-- - -See description above for instructions. - -```js -assert( - spreadsheetFunctions.has2([2, 3, 5]) && !spreadsheetFunctions.has2([1, 3, 10]) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-121.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-121.md deleted file mode 100644 index f6911f04f2..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-121.md +++ /dev/null @@ -1,299 +0,0 @@ ---- -id: 5d7925398157757b23730fdd -title: Part 121 -challengeType: 0 -dashedName: part-121 ---- - -# --description-- - -The `reduce` method can take a second argument (in addition to the function), specifying the initial accumulator value. In this case, the current value starts from index 0 rather than index 1: - -```js -[1, [1, 2, 3], [3, 4, 5]].reduce((a, x) => a.concat(x), []); // [1, 1, 2, 3, 3, 4, 5] -// without the second argument, it first tries 1.concat([1, 2, 3]), but 1 is not an array -// now it first tries [].concat(1) which works -``` - -Add a function `nodups` to `spreadsheetFunctions`, with the value `arr => arr.reduce((a, x) => a.includes(x), [])`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /nodups['"]?:arr=>arr\.reduce\(\(a,x\)=>a\.includes\(x\),\[\]\)/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-122.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-122.md deleted file mode 100644 index e8d2eeace5..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-122.md +++ /dev/null @@ -1,291 +0,0 @@ ---- -id: 5d792539de4b9ac14dd40409 -title: Part 122 -challengeType: 0 -dashedName: part-122 ---- - -# --description-- - -Use the ternary operator in `nodups` to return `a` if `a.includes(x)` and `a.concat(x)` otherwise. - -# --hints-- - -See description above for instructions. - -```js -assert( - JSON.stringify(spreadsheetFunctions.nodups([1, 3, 1, 5, 7, 7, 9, 7])) === - '[1,3,5,7,9]' -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-123.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-123.md deleted file mode 100644 index 384148b218..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-123.md +++ /dev/null @@ -1,296 +0,0 @@ ---- -id: 5d792539534f1bf991bb987f -title: Part 123 -challengeType: 0 -dashedName: part-123 ---- - -# --description-- - -ES6 introduced a shorthand object literal syntax: - -```js -const a = 10; -const myObject = { a }; -console.log(myObject); // { a: 10 } -``` - -First, move `sum` outside of `spreadsheetFunctions`. `sum` should be a function expression similar to `isEven`. - -# --hints-- - -See description above for instructions. - -```js -assert(sum([1, 2, 3]) === 6); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-124.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-124.md deleted file mode 100644 index acae8adba0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-124.md +++ /dev/null @@ -1,291 +0,0 @@ ---- -id: 5d7925394089b762f93ffa52 -title: Part 124 -challengeType: 0 -dashedName: part-124 ---- - -# --description-- - -Now use the shorthand syntax to reference `sum` inside of `spreadsheetFunctions`. - -This both adds it to the functions you can use in the spreadsheet, and allows you to use it throughout your program. - -# --hints-- - -See description above for instructions. - -```js -assert(/[{,]sum[,}]/.test(code.replace(/\s/g, ''))); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-125.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-125.md deleted file mode 100644 index e997b64fbb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-125.md +++ /dev/null @@ -1,296 +0,0 @@ ---- -id: 5d792539ec758d45a6900173 -title: Part 125 -challengeType: 0 -dashedName: part-125 ---- - -# --description-- - -The `length` property returns the length of an array. Use this property with the `sum` function to define an `average` function. - -As with `sum`, add this function to both the global scope and to `spreadsheetFunctions`. - -# --hints-- - -See description above for instructions. - -```js -assert( - average([1, 5, 12]) === 6 && spreadsheetFunctions.average([1, 20, 3, 8]) === 8 -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-126.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-126.md deleted file mode 100644 index 2c5eb36952..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-126.md +++ /dev/null @@ -1,306 +0,0 @@ ---- -id: 5d7925398d525f61a9ff3a79 -title: Part 126 -challengeType: 0 -dashedName: part-126 ---- - -# --description-- - -The spread operator allow you to pass multiple arguments instead of an array: - -```js -const arr = [1, 2, 3]; -const sum3 = (a, b, c) => a + b + c; -sum3(...arr); // 6 -``` - -Use the spread operator to add `range` to `spreadsheetFunctions`. - -# --hints-- - -See description above for instructions. - -```js -assert( - JSON.stringify(spreadsheetFunctions.range([1, 5])) === '[1,2,3,4,5]' && - code.includes('...') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-127.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-127.md deleted file mode 100644 index de3c69ec7f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-127.md +++ /dev/null @@ -1,298 +0,0 @@ ---- -id: 5d792539a222f385c5c17d2b -title: Part 127 -challengeType: 0 -dashedName: part-127 ---- - -# --description-- - -Now define a `median` function which takes an argument `nums` (in the global scope). - -# --hints-- - -See description above for instructions. - -```js -assert(/constmedian=\(?nums\)?=>/.test(code.replace(/\s/g, ''))); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-128.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-128.md deleted file mode 100644 index 548c01e3da..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-128.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -id: 5d7925398a7184b41b12a0e0 -title: Part 128 -challengeType: 0 -dashedName: part-128 ---- - -# --description-- - -The `sort` method sorts an array alphabetically: - -```js -["B", "C", "A"].sort(); // ["A", "B", "C"] -``` - -Assign the sorted `nums` to `sorted` in `median`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').includes('constmedian=nums=>{constsorted=nums.sort()') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-129.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-129.md deleted file mode 100644 index 6e638ef7db..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-129.md +++ /dev/null @@ -1,316 +0,0 @@ ---- -id: 5d7925399afb905c34730a75 -title: Part 129 -challengeType: 0 -dashedName: part-129 ---- - -# --description-- - -But our function takes an array of numbers, not strings. Luckily, you can pass a function `fn` as argument to sort: - -```js -[2, 9, 10, 15].sort((a, b) => b - a); // [10, 9, 5, 2] -``` - -If `b - a` is less than 0, then `a` will be placed before `b`. As a result, this sorts the array in descending order. - -Use `sort` to sort `nums` in ascending order. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constmedian=nums=>\{constsorted=nums\.sort\(\((.+),(.+)\)=>\1-\2\)/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-130.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-130.md deleted file mode 100644 index 7c7978b4ff..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-130.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -id: 5d792539728d1aa7788e2c9b -title: Part 130 -challengeType: 0 -dashedName: part-130 ---- - -# --description-- - -Unfortunately, `sort` not only returns a new array, but also modifies the existing one. So our function also modifies the array passed to it - it is impure. - -You can fix this by adding `.slice()` between `nums` and `sort` - this creates a new array, that is equivalent to `nums`, but is immediately discarded, so it doesn't matter if it changes. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constmedian=nums=>\{constsorted=nums\.slice\(\)\.sort\(\((.+),(.+)\)=>\1-\2\)/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-131.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-131.md deleted file mode 100644 index 08f1fb59b9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-131.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -id: 5d79253939434a2724c0ec41 -title: Part 131 -challengeType: 0 -dashedName: part-131 ---- - -# --description-- - -Now define two variable: `length` which is `sorted.length` and `middle` which is `length / 2 - 1`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constmedian=nums=>\{constsorted=nums\.slice\(\)\.sort\(\((.+),(.+)\)=>\1-\2\);?constlength=sorted\.length;?constmiddle=length\/2-1/.test( - code.replace(/\s/g, '') - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-132.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-132.md deleted file mode 100644 index ffad944ec9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-132.md +++ /dev/null @@ -1,309 +0,0 @@ ---- -id: 5d792539b9e1d3c54d8fe94a -title: Part 132 -challengeType: 0 -dashedName: part-132 ---- - -# --description-- - -Add a return statement to `median` so that it returns `isEven(length)`. - -# --hints-- - -See description above for instructions. - -```js -assert(median([1, 2, 3, 4]) && !median([1, 2, 3])); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-133.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-133.md deleted file mode 100644 index 1c5e09a840..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-133.md +++ /dev/null @@ -1,314 +0,0 @@ ---- -id: 5d792539b2e0bd8f9e8213e4 -title: Part 133 -challengeType: 0 -dashedName: part-133 ---- - -# --description-- - -Use the ternary operator to return `average([sorted[middle], sorted[middle + 1]])` if `length` is even, and `sorted[middle + 0.5]` otherwise. - -Note that the `middle` variable is close to the middle but is not actually the middle. - -# --hints-- - -See description above for instructions. - -```js -assert(median([1, 20, 3]) === 3 && median([27, 7, 20, 10]) === 15); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-134.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-134.md deleted file mode 100644 index 3e509e7c06..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-134.md +++ /dev/null @@ -1,318 +0,0 @@ ---- -id: 5d792539239148965a1a59a5 -title: Part 134 -challengeType: 0 -dashedName: part-134 ---- - -# --description-- - -Now add `median` to `spreadsheetFunctions`, just like you added `sum` and `average`. - -# --hints-- - -See description above for instructions. - -```js -assert( - spreadsheetFunctions.median([1, 20, 3]) === 3 && - spreadsheetFunctions.median([27, 7, 20, 10]) === 15 -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-135.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-135.md deleted file mode 100644 index 6986d1e317..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-135.md +++ /dev/null @@ -1,323 +0,0 @@ ---- -id: 5d792539e1446045d0df6d28 -title: Part 135 -challengeType: 0 -dashedName: part-135 ---- - -# --description-- - -The `some` method checks if any element of the array satisfies the provided testing function. - -Add `someeven` to `spreadsheetFunctions`, which checks if any of the items passed in are even. - -# --hints-- - -See description above for instructions. - -```js -assert( - spreadsheetFunctions.someeven([1, 5, 4, 3]) && - !spreadsheetFunctions.someeven([3, 5, 9]) && - code.includes('.some') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-136.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-136.md deleted file mode 100644 index 77fd516850..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-136.md +++ /dev/null @@ -1,325 +0,0 @@ ---- -id: 5d79253a2febbb77098730b9 -title: Part 136 -challengeType: 0 -dashedName: part-136 ---- - -# --description-- - -The `every` method checks if all elements of an array satisfy the provided testing function. - -Use it to add an `everyeven` function to `spreadsheetFunctions` which checks if all values passed in are even`spreadsheetFunctions` which checks if all values passed in are even. - -# --hints-- - -See description above for instructions. - -```js -assert( - spreadsheetFunctions.everyeven([2, 6, 4, 0, 20]) && - !spreadsheetFunctions.everyeven([10, 0, 9, 2]) && - code.includes('.every') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-137.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-137.md deleted file mode 100644 index 0ca5e5edcb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-137.md +++ /dev/null @@ -1,326 +0,0 @@ ---- -id: 5d79253a98bd9fdf7ce68d0a -title: Part 137 -challengeType: 0 -dashedName: part-137 ---- - -# --description-- - -We've used recursion in `range`, but recursion can have performance issues in JavaScript. If performance is an issue, you should try to use a higher order function like `reduce`, and if you can't do that, you'll probably have to use a for/while loop. - -While we don't expect the user to enter particularly large numbers so that performance is an issue, we're going to refactor `range` as an exercise. - -Replace the body of `range` with `start`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /constrange=\(start,end\)=>start(;|const)/.test(code.replace(/\s/g, '')) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-138.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-138.md deleted file mode 100644 index 986d8afd6e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-138.md +++ /dev/null @@ -1,322 +0,0 @@ ---- -id: 5d79253a1e9abf29de64c177 -title: Part 138 -challengeType: 0 -dashedName: part-138 ---- - -# --description-- - -The `Array` function takes an argument `x` and creates an array of size `x` filled with `undefined`. - -Make `range` return an array of `undefined` with size `end - start + 1`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').includes('constrange=(start,end)=>Array(end-start+1)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-139.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-139.md deleted file mode 100644 index 6421781e30..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-139.md +++ /dev/null @@ -1,325 +0,0 @@ ---- -id: 5d79253a8b29d78984369e4b -title: Part 139 -challengeType: 0 -dashedName: part-139 ---- - -# --description-- - -The `fill` method takes an argument and replaces all elements of the array with that argument. - -Use it on the array in `range` to replace everything with `start`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes('constrange=(start,end)=>Array(end-start+1).fill(start)') -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-140.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-140.md deleted file mode 100644 index 1ef0f5e749..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-140.md +++ /dev/null @@ -1,328 +0,0 @@ ---- -id: 5d79253ad297a31cbe073718 -title: Part 140 -challengeType: 0 -dashedName: part-140 ---- - -# --description-- - -The function in the `map` method can actually take a second argument: the index of the element. - -This is why you need an arrow function in `charRange` - if you don't use one, then the index will be passed to `String.fromCharCode` as the second argument, leading to unexpected results. However, it is safe for functions like `parseFloat` which take only one argument (but not for `parseInt`). - -Chain `.map((x, i) => x + i)` to `.fill(start)` to add its index to every element in the array in `range`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .includes( - 'constrange=(start,end)=>Array(end-start+1).fill(start).map((x,i)=>x+i)' - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-141.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-141.md deleted file mode 100644 index 97decd495b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-141.md +++ /dev/null @@ -1,316 +0,0 @@ ---- -id: 5dc10b8b93704f41d279eb5b -title: Part 141 -challengeType: 0 -dashedName: part-141 ---- - -# --description-- - -Congratulations, you've finished your functional programming spreadsheet! Now test it out by crunching some numbers. - -# --hints-- - -See description above for instructions. - -```js - -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - Spreadsheet - - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-001.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-001.md deleted file mode 100644 index 11916a0bd1..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-001.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44d9a -title: Part 1 -challengeType: 0 -dashedName: part-1 ---- - -# --description-- - -When a browser loads a page, it creates a Document Object Model (DOM) representation of the page which includes all of the HTML elements in a tree structure. - -In JavaScript, you can access the DOM by referencing the global `document` object. - -To view the DOM, log it to the console with `console.log(document)`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/console\.log\(document\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast
- Lunch
- Dinner -
- - - -
-
-
-``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-002.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-002.md deleted file mode 100644 index 836ff253cb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-002.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44d9b -title: Part 2 -challengeType: 0 -dashedName: part-2 ---- - -# --description-- - -In our HTML document, we have a form element with an `id` attribute: `
` - -To reference and access this particular form in JavaScript, we can use the getElementById() method on the document and provide the ID. - -The code `document.getElementById('my-form')` gets a reference to an HTML element with an `id` of `my-form`. Get a reference to the HTML element with the `id` of `calorie-form`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/document\.getElementById\([\'\"\`]calorie\-form[\'\"\`]\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
- -

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - - -
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-003.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-003.md deleted file mode 100644 index ab6cbd0394..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-003.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44d9c -title: Part 3 -challengeType: 0 -dashedName: part-3 ---- - -# --description-- - -Now we need to specify what should be done with the form when the user submits it by clicking the Calculate button. - -Forms have an `onsubmit` event that can execute a function when the form is submitted. - -For example, in `document.getElementById('my-form').onsubmit = processForm;`, the function `processForm` will run when the form is submitted. - -Assign a function named `calculate` to the `onsubmit` event of your form. - -You will create the `calculate` function later. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /document\.getElementById\([\'\"\`]calorie\-form[\'\"\`]\)\.onsubmit\=calculate/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-004.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-004.md deleted file mode 100644 index 021897b9fb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-004.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44d9d -title: Part 4 -challengeType: 0 -dashedName: part-4 ---- - -# --description-- - -Create the `calculate` function that will hold the code to sum up the user's calorie inputs. Leave the body blank for now. Here is an example of an empty function called `square`: - -```js -function square() {} -``` - -# --hints-- - -See description above for instructions. - -```js -assert(typeof calculate === 'function'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-005.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-005.md deleted file mode 100644 index e359f47d12..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-005.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44d9e -title: Part 5 -challengeType: 0 -dashedName: part-5 ---- - -# --description-- - -By default, `onsubmit` will pass the event object as a parameter to the function it calls. People usually call it `e`, short for event. Update the `calculate()` function to accept `e` as parameter. - -Here is an example of an empty function called `square` that takes a `number` as a parameter: - -```js -function square(number) {} -``` - -# --hints-- - -See description above for instructions. - -```js -assert(calculate.toString().match(/function calculate\(\s*e\)\s*\{\s*\}/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-006.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-006.md deleted file mode 100644 index 6cffeae2a3..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-006.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44d9f -title: Part 6 -challengeType: 0 -dashedName: part-6 ---- - -# --description-- - -When a form is submitted, the browser will try to submit it to a server and reload the page. We want to prevent this from happening and do our own processing on the client side. - -Prevent the default behavior of the form submit event by calling `e.preventDefault()` inside of the `calculate` function. - -# --hints-- - -See description above for instructions. - -```js -assert(calculate.toString().match(/e\.preventDefault\(\s*\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-007.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-007.md deleted file mode 100644 index e21db1cd71..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-007.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da0 -title: Part 7 -challengeType: 0 -dashedName: part-7 ---- - -# --description-- - -If you inspect the inputs in the form, you will notice that they have the class name `cal-control`. - -To access elements with a certain class name, we use the `getElementsByClassName()` method. - -Similar to how you referenced the calorie form above (`document.getElementById('calorie-form')`), create a reference to the elements with the class name `cal-control` below `e.preventDefault()`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/document\.getElementsByClassName\([\'\"\`]cal\-control[\'\"\`]\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-008.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-008.md deleted file mode 100644 index b25fbf6bfc..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-008.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da1 -title: Part 8 -challengeType: 0 -dashedName: part-8 ---- - -# --description-- - -Now assign the document object you just referenced to a variable named `total`. Since this variable will not change, use `const` to create it. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*total\s*=\s*document\.getElementsByClassName\([\'\"\`]cal\-control[\'\"\`]\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-009.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-009.md deleted file mode 100644 index 856e7553ed..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-009.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da2 -title: Part 9 -challengeType: 0 -dashedName: part-9 ---- - -# --description-- - -To make the document objects easier to handle, let's turn them into an array. Wrap the `document.getElementsByClassName('cal-control')` portion of your code in an `Array.from()` method. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /Array\.from\(document\.getElementsByClassName\([\'\"\`]cal\-control[\'\"\`]\)\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-010.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-010.md deleted file mode 100644 index d35af38630..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-010.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da3 -title: Part 10 -challengeType: 0 -dashedName: part-10 ---- - -# --description-- - -Create a variable named `meal` and set it equal to the first index of `total` (`total[0]`). This would be the input for Breakfast on the form. - -# --hints-- - -See description above for instructions. - -```js -assert(/const\s*meal\s*=\s*total\[0\]/.test(code)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-011.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-011.md deleted file mode 100644 index 5308378f39..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-011.md +++ /dev/null @@ -1,115 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da4 -title: Part 11 -challengeType: 0 -dashedName: part-11 ---- - -# --description-- - -Log `meal.value` to the console, enter a number in the Breakfast input and hit the Calculate button. You'll notice that it displays what you entered. - -# --hints-- - -See description above for instructions. - -```js - -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-012.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-012.md deleted file mode 100644 index a8300b97fe..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-012.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da5 -title: Part 12 -challengeType: 0 -dashedName: part-12 ---- - -# --description-- - -We need a way to iterate through all the `meal` items in the `total` array and return the values that the user entered as an array. - -The `map()` method allows us to do exactly that. - -Delete `const meal = total[0];` and chain the `.map()` method to the end of your `Array.from()` method. Here's an example of `.map()` chained to an array: `[3, 2, 1].map()` - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .toString() - .replace(/\s/g, '') - .match( - /Array\.from\(document\.getElementsByClassName\([\'\"\`]cal\-control[\'\"\`]\)\)\.map\(\)\;?/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-013.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-013.md deleted file mode 100644 index ae1c94fc7b..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-013.md +++ /dev/null @@ -1,125 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da6 -title: Part 13 -challengeType: 0 -dashedName: part-13 ---- - -# --description-- - -Now we need to provide a function to `map()` that will be performed on each item of the array. - -This function will take the original item as an argument, in our case we'll call it `meal`. Inside the `.map()` parentheses, insert an empty function that takes `meal` as a parameter, like: - -```js -function(meal){} -``` - -Enter in the above function as an argument in between the parentheses of the `.map()` function. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/map\(function\(\s*meal\)\{\}\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-014.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-014.md deleted file mode 100644 index 1520535d96..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-014.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da7 -title: Part 14 -challengeType: 0 -dashedName: part-14 ---- - -# --description-- - -Inside the function body, insert `return meal.value`, since it is the value of the individual `cal-control` inputs that we want. - -If you want, console log `total` to see what results you are getting. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').match(/\(function\(meal\)\{returnmeal\.value\;?\}\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-015.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-015.md deleted file mode 100644 index 7add952801..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-015.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da8 -title: Part 15 -challengeType: 0 -dashedName: part-15 ---- - -# --description-- - -Since eventually we'll be adding all of the meal calories in the `total` array, explicitly convert `meal.value` into a number by wrapping it in the `Number()` function. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/Number\(meal\.value\)\;?/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-016.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-016.md deleted file mode 100644 index 21a207e25a..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-016.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44da9 -title: Part 16 -challengeType: 0 -dashedName: part-16 ---- - -# --description-- - -Now let's simplify the function by refactoring it to use arrow functions. As an example, `function(x) {return x*x}` can be refactored as`x => x*x`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/meal\=\>Number\(meal\.value\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-017.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-017.md deleted file mode 100644 index 1417798fe2..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-017.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44daa -title: Part 17 -challengeType: 0 -dashedName: part-17 ---- - -# --description-- - -While you can use a loop to add everything in the `total` array to a variable, JavaScript provides the useful `reduce()` method. - -Chain the `reduce()` method to the `Array.from()` expression. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/Number\(meal\.value\)\)\.reduce\(\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-018.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-018.md deleted file mode 100644 index 5231d42570..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-018.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dab -title: Part 18 -challengeType: 0 -dashedName: part-18 ---- - -# --description-- - -The `reduce()` method takes a callback function with at least two arguments, an accumulator and a current value: - -```js -function(accumulator, currentValue) { /* code to run */ } -``` - -or using arrow functions: - -```js -(accumulator, currentValue) => { /* code to run */ } -``` - -Insert the above callback function as an argument in the `.reduce()` method. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/reduce\(\(accumulator\,currentValue\)\=\>\{\/\*codetorun\*\/\}\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-019.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-019.md deleted file mode 100644 index 04ec061d78..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-019.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dac -title: Part 19 -challengeType: 0 -dashedName: part-19 ---- - -# --description-- - -Provide the number zero as the initial value of the `reduce()` method by passing it as the second argument. - -Here is an example of a `reduce()` method with an empty object as its initial value: - -```js -arr.reduce((accumulator, currentValue) => { - /* code to run */ -}, {}); -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /reduce\(\(accumulator\,currentValue\)\=\>\{\/\*codetorun\*\/\}\,0\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-020.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-020.md deleted file mode 100644 index 1c7e67060f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-020.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dad -title: Part 20 -challengeType: 0 -dashedName: part-20 ---- - -# --description-- - -Let's says we have an array `[1, 3, 5]` named `arr` and we want to sum up all the numbers. - -We can use the reduce function as follows: - -```js -arr.reduce((accumulator, currentValue) => { - return accumulator + currentValue; -}, 0); -``` - -At `arr[0]`, the function is `(0, 1) => { return 0 + 1 }`, since `arr[0] = 1 = currentValue`. - -At `arr[1]`, the function is `(1, 3) => 1 + 3`, - -Finally at `arr[2]`, the function is `(4, 5) => 4 + 5`. Now the accumulator is `9` and since we have gone through all of the items in `arr`, the `reduce()` method will return `9`. - -In the body of the callback function, replace `/* code to run */` with `return accumulator + currentValue`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /reduce\(\(accumulator\,currentValue\)\=\>{returnaccumulator\+currentValue\;?},0\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-021.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-021.md deleted file mode 100644 index 3f40afa537..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-021.md +++ /dev/null @@ -1,134 +0,0 @@ ---- -id: 5e302e80e003129199103c78 -title: Part 21 -challengeType: 0 -dashedName: part-21 ---- - -# --description-- - -To track how the `reduce()` function works, log the values of the `accumulator` and `currentValue` in the callback function before the `return` statement like this: `console.log({ accumulator })` - -You can also check your progress by adding `console.log({ total })` at the end of the `calculate()` function. - -When you enter calorie values in the form and push the Calculate button, you will see the values of `accumulator` and `currentValue` in each iteration of the `reduce()` callback function. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/console.log\({accumulator}\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-022.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-022.md deleted file mode 100644 index 804e6f5524..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-022.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -id: 5e302e8ce003129199103c79 -title: Part 22 -challengeType: 0 -dashedName: part-22 ---- - -# --description-- - -Now let's simplify the `reduce()` callback function by refactoring it. - -Essentially, the current callback function is `(accumulator, currentValue) => { return accumulator + currentValue }`. Since there's only one expression in the function body, we can omit the `{}`. Additionally, we can omit the `return` keyword since that is implicit when using arrow function syntax. - -So the function can be simplified to just `(accumulator, currentValue) => accumulator + currentValue`. - -Replace the current callback function argument in the `reduce()` function with the simplified callback function from above. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /reduce\(\(accumulator\,currentValue\)\=\>accumulator\+currentValue\,0\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-023.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-023.md deleted file mode 100644 index 09974dcdf7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-023.md +++ /dev/null @@ -1,131 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dae -title: Part 23 -challengeType: 0 -dashedName: part-23 ---- - -# --description-- - -Now that we have the `total` number of calories that the user entered, we need to determine the maximum calories they should consume. - -Look at the form and notice that there are radio buttons for Female and Male. If Female is selected, the maximum calories consumed should be 2000, and if Male is selected, the maximum should be 2500. - -If you inspect the Female radio button you will notice its id: `` - -Create a variable named `maxCalories` and set it equal to the document element with the id of `female`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*maxCalories\s*=\s*document\.getElementById\([\'\"\`]female[\'\"\`]\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-024.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-024.md deleted file mode 100644 index 780a8572db..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-024.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44daf -title: Part 24 -challengeType: 0 -dashedName: part-24 ---- - -# --description-- - -Inspect the Female radio button again and notice that it has a `checked` attribute if it's checked: `` - -Check to see if the Female radio button is checked or not by chaining on the `.checked` attribute to `document.getElementById('female')`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*maxCalories\s*=\s*document\.getElementById\([\'\"\`]female[\'\"\`]\)\.checked/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-025.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-025.md deleted file mode 100644 index dfe3a8c520..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-025.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db0 -title: Part 25 -challengeType: 0 -dashedName: part-25 ---- - -# --description-- - -Use a ternary operator to assign the value of `maxCalories`. A ternary operator has the following syntax: `condition ? expressionTrue : expressionFalse`. - -For example, `(5 - 3 === 4) ? "Yes" : "No"` does the same thing as the following if else statement: - -```js -if (5 - 3 === 4) { - return 'Yes'; -} else { - return 'No'; -} -``` - -`document.getElementById('female').checked` will return either `true` if it is checked or `false` if it isn't. Use a ternary operator to return 2000 if it is is checked and 2500 if it is not. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*maxCalories\s*=\s*document\.getElementById\([\'\"\`]female[\'\"\`]\)\.checked\s*\?\s*2000\s*\:\s*2500/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-026.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-026.md deleted file mode 100644 index ccbc32e253..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-026.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db1 -title: Part 26 -challengeType: 0 -dashedName: part-26 ---- - -# --description-- - -Now that we have `total` and `maxCalories`, we need to find out the difference between them. - -Create a variable named `difference` and set it equal to `total - maxCalories` - -# --hints-- - -See description above for instructions. - -```js -assert(/const\s*difference\s*\=\s*total\s*\-\s*maxCalories?/.test(code)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-027.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-027.md deleted file mode 100644 index 5a171c5455..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-027.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db2 -title: Part 27 -challengeType: 0 -dashedName: part-27 ---- - -# --description-- - -If `difference` is positive, the total calories the user ate is more than the `maxCalories` recommended, or a calories surplus -- otherwise, if `difference` is negative, the user has a calorie deficit. - -To determine if this is a calorie surplus or deficit, create a variable named `surplusOrDeficit` to determine if the difference is positive (`difference > 0`). - -If it is positive, `surplusOrDeficit` should be set equal to the string "Surplus", and "Deficit" if negative. - -Use the same ternary syntax that you used to determine `maxCalories`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*surplusOrDeficit\s*\=\s*difference\s*\>\s*0\s*\?\s*[\'\"\`]Surplus[\'\"\`]\s*\:\s*[\'\"\`]Deficit[\'\"\`]/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-028.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-028.md deleted file mode 100644 index 3a16672714..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-028.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db3 -title: Part 28 -challengeType: 0 -dashedName: part-28 ---- - -# --description-- - -If you look near the bottom of the HTML page, notice that there is currently an empty `div` element: `
`. - -We will be inserting output inside this `div`, telling the user if they are in a calorie surplus or deficit. - -Create a variable named `output` and set it equal to this division element with the `id` of `output`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*output\s*=\s*document\.getElementById\([\'\"\`]output[\'\"\`]\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-029.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-029.md deleted file mode 100644 index 54259be1df..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-029.md +++ /dev/null @@ -1,149 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db4 -title: Part 29 -challengeType: 0 -dashedName: part-29 ---- - -# --description-- - -Now it's time to create the HTML elements that we will add inside of `output`. - -To create an element, use `createElement()`. For example: - -```js -const myHeading1 = document.createElement('h1') -``` - -Create an `h3` element and assign it to a variable named `result`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*result\s*=\s*document\.createElement\([\'\"\`]h3[\'\"\`]\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-030.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-030.md deleted file mode 100644 index 5cb153bb9c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-030.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db5 -title: Part 30 -challengeType: 0 -dashedName: part-30 ---- - -# --description-- - -Next, we will create a text node that we will later append to the `result` element. - -JavaScript has a function called `createTextNode()` to accomplish this. For example: - -```js -const myText = document.createTextNode("Hello world!") -``` - -Create a variable named `resultText` and set it equal to a text node. Leave the string empty for now. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*resultText\s*=\s*document\.createTextNode\([\'\"\`]?\s*[\'\"\`]?\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-031.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-031.md deleted file mode 100644 index cb1be5df67..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-031.md +++ /dev/null @@ -1,149 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db6 -title: Part 31 -challengeType: 0 -dashedName: part-31 ---- - -# --description-- - -We can now use the `difference` variable that we created above. - -Insert the `difference` variable inside the parentheses of `.createTextNode()` - -If you want to see what the text currently looks like, try `console.log(resultText)`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*resultText\s*=\s*document\.createTextNode\(\s*difference\s*?\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-032.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-032.md deleted file mode 100644 index 58d8630ee3..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-032.md +++ /dev/null @@ -1,149 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db7 -title: Part 32 -challengeType: 0 -dashedName: part-32 ---- - -# --description-- - -Notice how if `total` is less than `maxCalories`, `difference` is a negative number. - -We want to show the absolute value of the difference so it displays "300" rather than "-300". - -Wrap the `difference` in a `Math.abs()` function. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*resultText\s*=\s*document\.createTextNode\(\s*Math\.abs\(\s*difference\s*\)\s*\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-033.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-033.md deleted file mode 100644 index ba76ffd6f4..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-033.md +++ /dev/null @@ -1,147 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db8 -title: Part 33 -challengeType: 0 -dashedName: part-33 ---- - -# --description-- - -Inside the parentheses of `.createTextNode()`, add `+ ' Calorie '` after `Math.abs(difference))`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*resultText\s*=\s*document\.createTextNode\(\s*Math\.abs\(\s*difference\s*\)\s*\+\s*[\'\"\`]\s*Calorie\s*[\'\"\`]\s*\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-034.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-034.md deleted file mode 100644 index 2a607d5640..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-034.md +++ /dev/null @@ -1,151 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44db9 -title: Part 34 -challengeType: 0 -dashedName: part-34 ---- - -# --description-- - -Next we want to add the text from the `surplusOrDeficit` variable that we previously created. - -Inside the parentheses of `.createTextNode()` add `+ surplusOrDeficit` after `Math.abs(difference) + ' Calorie '`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*resultText\s*=\s*document\.createTextNode\(\s*Math\.abs\(\s*difference\s*\)\s*\+\s*[\'\"\`]\s*Calorie\s*[\'\"\`]\s*\+\s*surplusOrDeficit\s*\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-035.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-035.md deleted file mode 100644 index 3a2c170a59..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-035.md +++ /dev/null @@ -1,159 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dba -title: Part 35 -challengeType: 0 -dashedName: part-35 ---- - -# --description-- - -The data that we currently pass to `createTextNode()` is `Math.abs(difference) + ' Calorie ' + surplusOrDeficit`. - -Some people consider this a little cumbersome and prefer to use template literals instead. - -Template literals are enclosed in backticks (\`\`), and JavaScript expressions and variables can be embedded by enclosing them in `${}`. - -For example, ``console.log(`Hello ${firstName}, today is ${Date.now()}`)`` is the same as writing `console.log('Hello ' + firstName + ', today is ' + Date.now())`. - -Convert the data inside of `createTextNode()` to be a template literal. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /document\.createTextNode\(\`\$\{Math\.abs\(difference\)\}Calorie\$\{surplusOrDeficit\}\`/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-036.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-036.md deleted file mode 100644 index 909fc5870e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-036.md +++ /dev/null @@ -1,151 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dbb -title: Part 36 -challengeType: 0 -dashedName: part-36 ---- - -# --description-- - -Now you can append the `resultText` to the `result` with the `appendChild()` method, like this: - -```js -result.appendChild(resultText); -``` - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/result\.appendChild\(resultText\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-037.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-037.md deleted file mode 100644 index a22f22ccef..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-037.md +++ /dev/null @@ -1,152 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dbc -title: Part 37 -challengeType: 0 -dashedName: part-37 ---- - -# --description-- - -Similarly, append the `result` to the `output` element with the `appendChild()` method. - -Now if you enter in data and push the Calculate button, you will see the text added to the HTML document! - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/output\.appendChild\(result\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-038.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-038.md deleted file mode 100644 index 7d1ee71406..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-038.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dbd -title: Part 38 -challengeType: 0 -dashedName: part-38 ---- - -# --description-- - -Next, let's create and add a horizontal rule (`hr`) element to the output. - -Create an `hr` element and assign it to a variable named `line`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*line\s*=\s*document\.createElement\([\'\"\`]hr[\'\"\`]\)/.test(code) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-039.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-039.md deleted file mode 100644 index 206d1898de..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-039.md +++ /dev/null @@ -1,156 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dbe -title: Part 39 -challengeType: 0 -dashedName: part-39 ---- - -# --description-- - -Add the `line` to the `output` element using the `appendChild()` method. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/output\.appendChild\(line\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-040.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-040.md deleted file mode 100644 index 034a14b6df..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-040.md +++ /dev/null @@ -1,165 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dbf -title: Part 40 -challengeType: 0 -dashedName: part-40 ---- - -# --description-- - -Let's create a few more HTML elements to add to the `output`. - -Create an `h4` element and assign it to a variable named `recommended`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*recommended\s*=\s*document\.createElement\([\'\"\`]h4[\'\"\`]\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-041.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-041.md deleted file mode 100644 index 81f6c9481e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-041.md +++ /dev/null @@ -1,168 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc0 -title: Part 41 -challengeType: 0 -dashedName: part-41 ---- - -# --description-- - -Create a text node and assign it to a variable named `recommendedText`. - -This is similar to how your created the `resultText` element previously. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*recommendedText\s*=\s*document\.createTextNode\([\'\"\`]?\s*[\'\"\`]?\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-042.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-042.md deleted file mode 100644 index fc455be396..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-042.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc1 -title: Part 42 -challengeType: 0 -dashedName: part-42 ---- - -# --description-- - -We want the `recommendedText` to say "XX Calories Recommended" where "XX" is the `maxCalories` variable that was previously created. - -Update text of `recommendedText` to use the `maxCalories` variable in a template literal along with the text "Calories Recommended". - -This is similar to template literal syntax previously used to create `resultText`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/document\.createTextNode\(\`\$\{maxCalories\}RecommendedCalories\`/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-043.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-043.md deleted file mode 100644 index 863a2f9bce..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-043.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc2 -title: Part 43 -challengeType: 0 -dashedName: part-43 ---- - -# --description-- - -Append the `recommendedText` node to the `recommended` element. - -This is similar to how the `resultText` is appended to `result` previously. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').match(/recommended\.appendChild\(recommendedText\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-044.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-044.md deleted file mode 100644 index 3a86333103..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-044.md +++ /dev/null @@ -1,172 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc3 -title: Part 44 -challengeType: 0 -dashedName: part-44 ---- - -# --description-- - -Append the `recommended` element to `output`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/output\.appendChild\(recommended\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-045.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-045.md deleted file mode 100644 index ef995b910e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-045.md +++ /dev/null @@ -1,181 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc4 -title: Part 45 -challengeType: 0 -dashedName: part-45 ---- - -# --description-- - -Similar to the `recommended` element, we are going to create a `consumed` element that will display the amount of calories consumed. - -Create an `h4` element and assign it to a variable named `consumed`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*consumed\s*=\s*document\.createElement\([\'\"\`]h4[\'\"\`]\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-046.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-046.md deleted file mode 100644 index dee873ed2c..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-046.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc5 -title: Part 46 -challengeType: 0 -dashedName: part-46 ---- - -# --description-- - -Another way that we can set the text of the `consumed` element is to set the `innerHTML` property. - -For example: - -```js -consumed.innerHTML = `Hello world`; -``` - -Set the inner HTML of `consumed` to "XX Consumed Calories", where "XX" is the `total` variable that was previously created. Use template literals. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/consumed\.innerHTML\=\`\$\{total\}ConsumedCalories\`/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-047.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-047.md deleted file mode 100644 index 0ccaa018c3..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-047.md +++ /dev/null @@ -1,180 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc6 -title: Part 47 -challengeType: 0 -dashedName: part-47 ---- - -# --description-- - -Append the `consumed` element to `output`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/output\.appendChild\(consumed\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-048.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-048.md deleted file mode 100644 index 7db49671eb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-048.md +++ /dev/null @@ -1,191 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc7 -title: Part 48 -challengeType: 0 -dashedName: part-48 ---- - -# --description-- - -Now it's time to add some styling which can be added directly as attributes or classes. - -In our CSS file, we have a styling rule for any elements with the class name `green-text`. - -On line **20**, right after creating the `result` element, set the `className` property of `result` to be equal to `'green-text'`. - -Now if you submit the form again and inspect the `result` element, you will see it as `

` and notice that the text is now green. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').match(/result\.className\=[\'\"\`]green-text[\'\"\`]/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-049.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-049.md deleted file mode 100644 index a6e5a02cd0..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-049.md +++ /dev/null @@ -1,197 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc8 -title: Part 49 -challengeType: 0 -dashedName: part-49 ---- - -# --description-- - -You can also add styling with the `setAttribute()` method. This method takes two arguments: the name of the attribute and the value that the attribute should be. - -For example, if you want to set the `width` of an `input` element to 100px, you would write `input.setAttribute('width', '100px')`. - -Set the `class` attribute of the `output` element equal to a class named `bordered-class`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /output\.setAttribute\([\'\"\`]class[\'\"\`]\,[\'\"\`]bordered-class[\'\"\`]\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-050.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-050.md deleted file mode 100644 index 322df8ded1..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-050.md +++ /dev/null @@ -1,196 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dc9 -title: Part 50 -challengeType: 0 -dashedName: part-50 ---- - -# --description-- - -Another way to add styling is to use the `style` property directly, like `output.style.width = '300px'`. - -Add a `backgroundColor` style to `output` and set it equal to `'#FFF9C4'`. - -The `calculate()` function is now finished! - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/output\.style\.backgroundColor\=[\'\"\`]\#FFF9C4[\'\"\`]/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-051.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-051.md deleted file mode 100644 index fe824490f7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-051.md +++ /dev/null @@ -1,203 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dca -title: Part 51 -challengeType: 0 -dashedName: part-51 ---- - -# --description-- - -When the user clicks the "Add Entry" button, they should be provided with additional text inputs to enter in a food name and calorie amount. These will be included in the `calculate()` function. - -In the HTML document, notice that the "Add Entry" button has the `id` attribute `add`: - -```html - - - - -
- - - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-052.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-052.md deleted file mode 100644 index f4cadf1ca9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-052.md +++ /dev/null @@ -1,205 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dcb -title: Part 52 -challengeType: 0 -dashedName: part-52 ---- - -# --description-- - -We want a function to run every time the user clicks the "Add Entry" button. - -Chain the `onclick` property to the end of `document.getElementById('add')` and set it equal to an empty function: - -```js -function() {} -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /document\.getElementById\([\'\"\`]add[\'\"\`]\)\.onclick\=function\(\)\{\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-053.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-053.md deleted file mode 100644 index 8564d3e93d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-053.md +++ /dev/null @@ -1,201 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dcc -title: Part 53 -challengeType: 0 -dashedName: part-53 ---- - -# --description-- - -Inside the function, create an `input` document element and assign it to a variable named `foodInput`. - -This is similar to how you created the `result` element previously. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*foodInput\s*=\s*document\.createElement\([\'\"\`]input[\'\"\`]\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-054.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-054.md deleted file mode 100644 index 862dd108b7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-054.md +++ /dev/null @@ -1,202 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dcd -title: Part 54 -challengeType: 0 -dashedName: part-54 ---- - -# --description-- - -Set the `placeholder` property of the `foodInput` equal to `'food name'`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/foodInput\.placeholder\=[\'\"\`]foodname[\'\"\`]/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-055.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-055.md deleted file mode 100644 index a11aac552e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-055.md +++ /dev/null @@ -1,208 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dce -title: Part 55 -challengeType: 0 -dashedName: part-55 ---- - -# --description-- - -We want to add the class name `food-control` to the `foodInput` element. We will reference this class name when we remove these inputs later on. - -In addition to using the `setAttribute` method, we can also update the `classList` property to add a class name, like `myInput.classList.add('my-class)`. - -Add the class name `food-control` to the `foodInput` element. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/foodInput\.classList\.add\([\'\"\`]food\-control[\'\"\`]\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-056.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-056.md deleted file mode 100644 index cd13e1652e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-056.md +++ /dev/null @@ -1,212 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dcf -title: Part 56 -challengeType: 0 -dashedName: part-56 ---- - -# --description-- - -Notice that parent container of all of the inputs has an `id` of `entries`: `
`. - -Get a reference to the document element with the `id` attribute `entries` and append the `foodInput` element to it by chaining on the `.appendChild()` function. - -This is similar to the other `appendChild()` methods that you have used previously. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /document\.getElementById\([\'\"\`]entries[\'\"\`]\)\.appendChild\(foodInput\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-057.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-057.md deleted file mode 100644 index 6a35bb7ab9..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-057.md +++ /dev/null @@ -1,209 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd0 -title: Part 57 -challengeType: 0 -dashedName: part-57 ---- - -# --description-- - -Create a variable named `calorieInput` and set it equal to another `input` document element. This is similar to how you created the `foodInput`. - -# --hints-- - -See description above for instructions. - -```js -assert( - /const\s*calorieInput\s*=\s*document\.createElement\([\'\"\`]input[\'\"\`]\)/.test( - code - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-058.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-058.md deleted file mode 100644 index d81ee6e6a2..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-058.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd1 -title: Part 58 -challengeType: 0 -dashedName: part-58 ---- - -# --description-- - -Use the `setAttribute()` method of `calorieInput` to set the `type` of this input to `number`. - -This is similar to how to set the class of the `output` element previously. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /calorieInput\.setAttribute\([\'\"\`]type[\'\"\`]\,[\'\"\`]number[\'\"\`]\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-059.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-059.md deleted file mode 100644 index 348da09429..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-059.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd2 -title: Part 59 -challengeType: 0 -dashedName: part-59 ---- - -# --description-- - -The `calorieInput` element should only accept numbers that are 0 or above. - -Set the `min` attribute of `calorieInput` to `0`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /calorieInput\.setAttribute\([\'\"\`]min[\'\"\`]\,[\'\"\`]0[\'\"\`]\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-060.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-060.md deleted file mode 100644 index 420a10386d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-060.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd3 -title: Part 60 -challengeType: 0 -dashedName: part-60 ---- - -# --description-- - -Add a class named `cal-control` to the `calorieInput` element. This is similar to how you added a class name to the `foodInput` element previously. - -We are adding this class name because in the `calculate()` function you created previously, the `total` is calculated from the elements with the class name `cal-control`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/calorieInput\.classList\.add\([\'\"\`]cal\-control[\'\"\`]\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-061.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-061.md deleted file mode 100644 index a5d24110f7..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-061.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd4 -title: Part 61 -challengeType: 0 -dashedName: part-61 ---- - -# --description-- - -Later we will want to remove these extra `calorieInput` elements that we added. This will happen when the user pushes the "Clear" button. - -To keep track of them, add the class name `extra-cal-control` to the `calorieInput` element. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/calorieInput\.classList\.add\([\'\"\`]extra-cal\-control[\'\"\`]\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-062.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-062.md deleted file mode 100644 index 32f589a264..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-062.md +++ /dev/null @@ -1,224 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd5 -title: Part 62 -challengeType: 0 -dashedName: part-62 ---- - -# --description-- - -Add the `calorieInput` element to the element with the `id` of `entries` by using the `appendChild()` method. - -The Add Entry functionality is now finished. You can test it by clicking the "Add Entry" button, entering in food names and their calories, and then clicking the "Calculate" button. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /document\.getElementById\([\'\"\`]entries[\'\"\`]\)\.appendChild\(calorieInput\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-063.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-063.md deleted file mode 100644 index fb73ccba8f..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-063.md +++ /dev/null @@ -1,227 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd6 -title: Part 63 -challengeType: 0 -dashedName: part-63 ---- - -# --description-- - -Next we need a way to reset the form back to its original state. To do this, we specify what to do when the user clicks the "Clear" button. - -Get a reference to the `document` element with the `id` of `clear` and set its `onclick` property to equal to an empty function, `function(){}`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /document\.getElementById\([\'\"\`]clear[\'\"\`]\)\.onclick\=function\(\)\{\}/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-064.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-064.md deleted file mode 100644 index 331871b746..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-064.md +++ /dev/null @@ -1,224 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd7 -title: Part 64 -challengeType: 0 -dashedName: part-64 ---- - -# --description-- - -Inside the `function` body, instruct your code to call two other functions, `clearOutput()` and `clearForm()`. We will create these functions shortly. - -# --hints-- - -See description above for instructions. - -```js -assert(/clearOutput\(\)/.test(code) && /clearForm\(\)/.test(code)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-065.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-065.md deleted file mode 100644 index 4484fa0236..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-065.md +++ /dev/null @@ -1,235 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd8 -title: Part 65 -challengeType: 0 -dashedName: part-65 ---- - -# --description-- - -Create a variable named `clearOutput` and set it equal to a blank arrow function: - -```js -const clearOutput = () => {} -``` - -This is similar to `function clearOutput () {}`. - -# --hints-- - -See description above for instructions. - -```js -assert(typeof clearOutput === 'function'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-066.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-066.md deleted file mode 100644 index 2cdfc3804d..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-066.md +++ /dev/null @@ -1,241 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dd9 -title: Part 66 -challengeType: 0 -dashedName: part-66 ---- - -# --description-- - -We need to remove the contents inside of element with the `id` of `output`. - -In the body of the `clearOutput()` function, set the `innerHTML` property of that element equal to an empty string, `''`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /document\.getElementById\([\'\"\`]output[\'\"\`]\)\.innerHTML\=[\'\"\`][\'\"\`]/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-067.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-067.md deleted file mode 100644 index 4aa35cd16e..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-067.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dda -title: Part 67 -challengeType: 0 -dashedName: part-67 ---- - -# --description-- - -Now notice that if you click the "Clear" button, the `output` element is empty, but it still has a border around it. This is because we previously added the `bordered-class` class to this element. - -Remove the `bordered-class` class. For example: - -```js -document.getElementById('my-div').classList.remove('my-class') -``` - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /document\.getElementById\([\'\"\`]output[\'\"\`]\)\.classList\.remove\([\'\"\`]bordered-class[\'\"\`]\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-068.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-068.md deleted file mode 100644 index 11754ad575..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-068.md +++ /dev/null @@ -1,241 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44ddb -title: Part 68 -challengeType: 0 -dashedName: part-68 ---- - -# --description-- - -The `clearOutput` function is called when the user clicks the "Clear" button. But it also needs to be run when the user clicks the "Calculate" button. - -In the `calculate()` function, right after `event.preventDefault()`, call the `clearOutput` function. - -# --hints-- - -See description above for instructions. - -```js -assert(calculate.toString().match(/clearOutput\(\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-069.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-069.md deleted file mode 100644 index f6d8088b08..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-069.md +++ /dev/null @@ -1,241 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44ddc -title: Part 69 -challengeType: 0 -dashedName: part-69 ---- - -# --description-- - -Create a variable named `clearForm` and set it equal to a blank arrow function like you did with `clearOutput`. - -# --hints-- - -See description above for instructions. - -```js -assert(typeof clearForm === 'function'); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-070.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-070.md deleted file mode 100644 index 901e0c9e85..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-070.md +++ /dev/null @@ -1,257 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44ddd -title: Part 70 -challengeType: 0 -dashedName: part-70 ---- - -# --description-- - -We need to remove all elements with the class name `food-control` that are added when the user clicks the "Add" button. - -Inside the function body of `clearForm`, create a variable named `foodInputs` and set it equal to an array of elements with the class name `food-control`. - -This is similar to how you declared the `total` variable previously in the `calculate` method. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /const\s*foodInputs\s*=Array\.from\(document\.getElementsByClassName\([\'\"\`]food\-control[\'\"\`]\)\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-071.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-071.md deleted file mode 100644 index 3019af35d3..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-071.md +++ /dev/null @@ -1,255 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44dde -title: Part 71 -challengeType: 0 -dashedName: part-71 ---- - -# --description-- - -To remove the items `foodInputs` array, we will iterate through them by using the `forEach()` function. - -Add `foodInputs.forEach()`. - -# --hints-- - -See description above for instructions. - -```js -assert(code.replace(/\s/g, '').match(/foodInputs.forEach\(\)/)); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-072.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-072.md deleted file mode 100644 index 08f456d122..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-072.md +++ /dev/null @@ -1,261 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44ddf -title: Part 72 -challengeType: 0 -dashedName: part-72 ---- - -# --description-- - -We need to provide a callback function in the parentheses of `forEach()`. - -This function will take each input item, in our case we'll call it `input`, as an argument. Then inside the function body, we need to call the `remove()` method. - -In between the parentheses of the `.forEach()` function, enter `input => input.remove()`. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').match(/foodInputs.forEach\(input=>input.remove\(\)\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-073.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-073.md deleted file mode 100644 index 4389186108..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-073.md +++ /dev/null @@ -1,269 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44de0 -title: Part 73 -challengeType: 0 -dashedName: part-73 ---- - -# --description-- - -We also need to remove all elements with the class name `extra-cal-control` that are added when the user clicks the "Add" button. - -Create a variable named `calInputs` and set it equal to an array of elements with the class name `extra-cal-control`. - -This is similar to how you declared the `foodInputs` variable previously. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match( - /const\s*calInputs\s*=Array\.from\(document\.getElementsByClassName\([\'\"\`]extra-cal-control[\'\"\`]\)\)/ - ) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-074.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-074.md deleted file mode 100644 index 247b4c93eb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-074.md +++ /dev/null @@ -1,267 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44de1 -title: Part 74 -challengeType: 0 -dashedName: part-74 ---- - -# --description-- - -Similar to how you removed each `foodInputs` elements, use the `forEach()` function to remove each `calInputs` element. - -# --hints-- - -See description above for instructions. - -```js -assert( - code.replace(/\s/g, '').match(/calInputs.forEach\(input=>input.remove\(\)\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-075.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-075.md deleted file mode 100644 index 3ff7eeb2bb..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-075.md +++ /dev/null @@ -1,275 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44de2 -title: Part 75 -challengeType: 0 -dashedName: part-75 ---- - -# --description-- - -Finally, it's time to clear the other calories that may have been entered for Breakfast, Lunch, and Dinner. This can be achieved by calling the `reset()` method on the form. - -Get a reference to the document element with the `id` of `calorie-form` and chain the `reset()` method to it. - -# --hints-- - -See description above for instructions. - -```js -assert( - code - .replace(/\s/g, '') - .match(/document\.getElementById\([\'\"\`]calorie-form[\'\"\`]\).reset\(\)/) -); -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-076.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-076.md deleted file mode 100644 index d740ed6a26..0000000000 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-076.md +++ /dev/null @@ -1,185 +0,0 @@ ---- -id: 5ddb965c65d27e1512d44de3 -title: Part 76 -challengeType: 0 -dashedName: part-76 ---- - -# --description-- - -Congratulations! Have fun playing with your completed calorie counter. - -# --hints-- - -See description above for instructions. - -```js - -``` - -# --seed-- - -## --before-user-code-- - -```html - - - - - - - - - - -
-
-

Calorie Counter

-
- Sex -
- - - -
- - -
-
-
-
- Breakfast -
- Lunch -
- Dinner -
- - - -
-
-
- - -``` - -## --after-user-code-- - -```html - - -``` - -## --seed-contents-- - -```html - -``` - -# --solutions-- - -```html - -```