diff --git a/client/plugins/fcc-source-challenges/create-challenge-nodes.js b/client/plugins/fcc-source-challenges/create-challenge-nodes.js
index 5abe9b9f6e..e1896062e1 100644
--- a/client/plugins/fcc-source-challenges/create-challenge-nodes.js
+++ b/client/plugins/fcc-source-challenges/create-challenge-nodes.js
@@ -3,8 +3,14 @@ const crypto = require('crypto');
function createChallengeNode(challenge, reporter) {
// challengeType 11 is for video challenges (they only have instructions)
// challengeType 7 is for certificates (they only have tests)
+
+ // TODO: either handle empty descriptions inside Gatsby OR ensure that
+ // description defaults to '' when creating challenges.
+ // ditto for seeds and instructions.
+ // create-md should, then, not create empty seed, description or instruction
+ // sections.
if (
- typeof challenge.description[0] !== 'string' &&
+ typeof challenge.description !== 'string' &&
(challenge.challengeType !== 11 && challenge.challengeType !== 7)
) {
reporter.warn(`
diff --git a/client/plugins/fcc-source-challenges/gatsby-node.js b/client/plugins/fcc-source-challenges/gatsby-node.js
index 9f1ec3a942..0f4c71b68d 100644
--- a/client/plugins/fcc-source-challenges/gatsby-node.js
+++ b/client/plugins/fcc-source-challenges/gatsby-node.js
@@ -34,7 +34,7 @@ exports.sourceNodes = function sourceChallengesSourceNodes(
});
watcher.on('change', filePath =>
- /\.md$/.test(filePath)
+ /\.md?$/.test(filePath)
? onSourceChange(filePath)
.then(challenge => {
reporter.info(
@@ -61,13 +61,14 @@ File changed at ${filePath}, replacing challengeNode id ${challenge.id}
.then(challenges =>
challenges.map(challenge => createVisibleChallenge(challenge))
)
- .catch(e =>
+ .catch(e => {
+ console.log(e);
reporter.panic(`fcc-source-challenges
${e.message}
- `)
- );
+ `);
+ });
}
function createVisibleChallenge(challenge) {
diff --git a/client/src/templates/Challenges/components/Challenge-Description.js b/client/src/templates/Challenges/components/Challenge-Description.js
index ad6fcfd819..65a7bb9820 100644
--- a/client/src/templates/Challenges/components/Challenge-Description.js
+++ b/client/src/templates/Challenges/components/Challenge-Description.js
@@ -12,8 +12,8 @@ const propTypes = {
function ChallengeDescription({ description, instructions, section }) {
return (
-
-
+
+ {description && }
{instructions && (
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.md
index cadea225d1..eef444d35c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.md
@@ -6,53 +6,38 @@ videoUrl: 'https://scrimba.com/c/cPp7VfD'
forumTopicId: 16628
---
-## Description
-
-It's likely that you've seen an alt attribute on an img tag in other challenges. Alt text describes the content of the image and provides a text-alternative for it. This helps in cases where the image fails to load or can't be seen by a user. It's also used by search engines to understand what an image contains to include it in search results. Here's an example:
-<img src="importantLogo.jpeg" alt="Company logo">
-People with visual impairments rely on screen readers to convert web content to an audio interface. They won't get information if it's only presented visually. For images, screen readers can access the alt attribute and read its contents to deliver key information.
-Good alt text provides the reader a brief description of the image. You should always include an alt attribute on your image. Per HTML5 specification, this is now considered mandatory.
-
+# --description--
-## Instructions
-
+It's likely that you've seen an `alt` attribute on an `img` tag in other challenges. `Alt` text describes the content of the image and provides a text-alternative for it. This helps in cases where the image fails to load or can't be seen by a user. It's also used by search engines to understand what an image contains to include it in search results. Here's an example:
-Camper Cat happens to be both a coding ninja and an actual ninja, who is building a website to share his knowledge. The profile picture he wants to use shows his skills and should be appreciated by all site visitors. Add an alt attribute in the img tag, that explains Camper Cat is doing karate. (The image src doesn't link to an actual file, so you should see the alt text in the display.)
+``
-
+People with visual impairments rely on screen readers to convert web content to an audio interface. They won't get information if it's only presented visually. For images, screen readers can access the `alt` attribute and read its contents to deliver key information.
-## Tests
-
+Good `alt` text provides the reader a brief description of the image. You should always include an `alt` attribute on your image. Per HTML5 specification, this is now considered mandatory.
-```yml
-tests:
- - text: Your img tag should have an alt attribute and it should not be empty.
- testString: assert($('img').attr('alt'));
+# --instructions--
+Camper Cat happens to be both a coding ninja and an actual ninja, who is building a website to share his knowledge. The profile picture he wants to use shows his skills and should be appreciated by all site visitors. Add an `alt` attribute in the `img` tag, that explains Camper Cat is doing karate. (The image `src` doesn't link to an actual file, so you should see the `alt` text in the display.)
+
+# --hints--
+
+Your `img` tag should have an `alt` attribute and it should not be empty.
+
+```js
+assert($('img').attr('alt'));
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.md
index 16be4f16f2..811ca073a1 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.md
@@ -6,11 +6,14 @@ videoUrl: 'https://scrimba.com/c/cR3bRbCV'
forumTopicId: 301008
---
-## Description
-
-Forms often include the input field, which can be used to create several different form controls. The type attribute on this element indicates what kind of input will be created.
-You may have noticed the text and submit input types in prior challenges, and HTML5 introduced an option to specify a date field. Depending on browser support, a date picker shows up in the input field when it's in focus, which makes filling in a form easier for all users.
-For older browsers, the type will default to text, so it helps to show users the expected date format in the label or as placeholder text just in case.
+# --description--
+
+Forms often include the `input` field, which can be used to create several different form controls. The `type` attribute on this element indicates what kind of input will be created.
+
+You may have noticed the `text` and `submit` input types in prior challenges, and HTML5 introduced an option to specify a `date` field. Depending on browser support, a date picker shows up in the `input` field when it's in focus, which makes filling in a form easier for all users.
+
+For older browsers, the type will default to `text`, so it helps to show users the expected date format in the label or as placeholder text just in case.
+
Here's an example:
```html
@@ -18,35 +21,39 @@ Here's an example:
```
-
+# --instructions--
-## Instructions
-
-Camper Cat is setting up a Mortal Kombat tournament and wants to ask his competitors to see what date works best. Add an input tag with a type attribute of "date", an id attribute of "pickdate", and a name attribute of "date".
-
+Camper Cat is setting up a Mortal Kombat tournament and wants to ask his competitors to see what date works best. Add an `input` tag with a `type` attribute of "date", an `id` attribute of "pickdate", and a `name` attribute of "date".
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should add one input tag for the date selector field.
- testString: assert($('input').length == 2);
- - text: Your input tag should have a type attribute with a value of date.
- testString: assert($('input').attr('type') == 'date');
- - text: Your input tag should have an id attribute with a value of pickdate.
- testString: assert($('input').attr('id') == 'pickdate');
- - text: Your input tag should have a name attribute with a value of date.
- testString: assert($('input').attr('name') == 'date');
+Your code should add one `input` tag for the date selector field.
+```js
+assert($('input').length == 2);
```
-
+Your `input` tag should have a `type` attribute with a value of date.
-## Challenge Seed
-
+```js
+assert($('input').attr('type') == 'date');
+```
-
+Your `input` tag should have an `id` attribute with a value of pickdate.
+
+```js
+assert($('input').attr('id') == 'pickdate');
+```
+
+Your `input` tag should have a `name` attribute with a value of date.
+
+```js
+assert($('input').attr('name') == 'date');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -74,14 +81,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -102,5 +102,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.md
index 3635c31af8..5c76bfe858 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.md
@@ -1,39 +1,36 @@
---
id: 587d778f367417b2b2512aad
-title: Avoid Colorblindness Issues by Carefully Choosing Colors that Convey Information
+title: >-
+ Avoid Colorblindness Issues by Carefully Choosing Colors that Convey
+ Information
challengeType: 0
videoUrl: 'https://scrimba.com/c/c437as3'
forumTopicId: 301011
---
-## Description
-
+# --description--
+
There are various forms of colorblindness. These can range from a reduced sensitivity to a certain wavelength of light to the inability to see color at all. The most common form is a reduced sensitivity to detect greens.
+
For example, if two similar green colors are the foreground and background color of your content, a colorblind user may not be able to distinguish them. Close colors can be thought of as neighbors on the color wheel, and those combinations should be avoided when conveying important information.
-Note: Some online color picking tools include visual simulations of how colors appear for different types of colorblindness. These are great resources in addition to online contrast checking calculators.
-
-## Instructions
-
-Camper Cat is testing different styles for an important button, but the yellow (#FFFF33) background-color and the green (#33FF33) text color are neighboring hues on the color wheel and virtually indistinguishable for some colorblind users. (Their similar lightness also fails the contrast ratio check). Change the text color to a dark blue (#003366) to solve both problems.
-
+**Note:** Some online color picking tools include visual simulations of how colors appear for different types of colorblindness. These are great resources in addition to online contrast checking calculators.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should change the text color for the button to the dark blue.
- testString: assert($('button').css('color') == 'rgb(0, 51, 102)');
+Camper Cat is testing different styles for an important button, but the yellow (`#FFFF33`) `background-color` and the green (`#33FF33`) text `color` are neighboring hues on the color wheel and virtually indistinguishable for some colorblind users. (Their similar lightness also fails the contrast ratio check). Change the text `color` to a dark blue (`#003366`) to solve both problems.
+# --hints--
+
+Your code should change the text `color` for the `button` to the dark blue.
+
+```js
+assert($('button').css('color') == 'rgb(0, 51, 102)');
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -81,5 +71,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.md
index dbed30c7e7..a0512ae9bf 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.md
@@ -6,37 +6,37 @@ videoUrl: 'https://scrimba.com/c/cmzMEUw'
forumTopicId: 301012
---
-## Description
-
+# --description--
+
Color is a large part of visual design, but its use introduces two accessibility issues. First, color alone should not be used as the only way to convey important information because screen reader users won't see it. Second, foreground and background colors need sufficient contrast so colorblind users can distinguish them.
+
Previous challenges covered having text alternatives to address the first issue. The last challenge introduced contrast checking tools to help with the second. The WCAG-recommended contrast ratio of 4.5:1 applies for color use as well as gray-scale combinations.
+
Colorblind users have trouble distinguishing some colors from others - usually in hue but sometimes lightness as well. You may recall the contrast ratio is calculated using the relative luminance (or lightness) values of the foreground and background colors.
+
In practice, the 4.5:1 contrast ratio can be reached by shading (adding black to) the darker color and tinting (adding white to) the lighter color. Darker shades on the color wheel are considered to be shades of blues, violets, magentas, and reds, whereas lighter tinted colors are oranges, yellows, greens, and blue-greens.
-
-## Instructions
-
-Camper Cat is experimenting with using color for his blog text and background, but his current combination of a greenish background-color with maroon text color has a 2.5:1 contrast ratio. You can easily adjust the lightness of the colors since he declared them using the CSS hsl() property (which stands for hue, saturation, lightness) by changing the third argument. Increase the background-color lightness value from 35% to 55%, and decrease the color lightness value from 20% to 15%. This improves the contrast to 5.9:1.
-
+# --instructions--
-## Tests
-
+Camper Cat is experimenting with using color for his blog text and background, but his current combination of a greenish `background-color` with maroon text `color` has a 2.5:1 contrast ratio. You can easily adjust the lightness of the colors since he declared them using the CSS `hsl()` property (which stands for hue, saturation, lightness) by changing the third argument. Increase the `background-color` lightness value from 35% to 55%, and decrease the `color` lightness value from 20% to 15%. This improves the contrast to 5.9:1.
-```yml
-tests:
- - text: Your code should only change the lightness value for the text color property to a value of 15%.
- testString: assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi));
- - text: Your code should only change the lightness value for the background-color property to a value of 55%.
- testString: assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi));
+# --hints--
+Your code should only change the lightness value for the text `color` property to a value of 15%.
+
+```js
+assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi));
```
-
+Your code should only change the lightness value for the `background-color` property to a value of 55%.
-## Challenge Seed
-
+```js
+assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi));
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
@@ -89,5 +81,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.md
index 46187a4297..207f83f49c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.md
@@ -6,37 +6,46 @@ videoUrl: 'https://scrimba.com/c/c437DcV'
forumTopicId: 301013
---
-## Description
-
+# --description--
+
Screen reader users have different options for what type of content their device reads. This includes skipping to (or over) landmark elements, jumping to the main content, or getting a page summary from the headings. Another option is to only hear the links available on a page.
-Screen readers do this by reading the link text, or what's between the anchor (a) tags. Having a list of "click here" or "read more" links isn't helpful. Instead, you should use brief but descriptive text within the a tags to provide more meaning for these users.
-
-## Instructions
-
-The link text that Camper Cat is using is not very descriptive without the surrounding context. Move the anchor (a) tags so they wrap around the text "information about batteries" instead of "Click here".
-
+Screen readers do this by reading the link text, or what's between the anchor (`a`) tags. Having a list of "click here" or "read more" links isn't helpful. Instead, you should use brief but descriptive text within the `a` tags to provide more meaning for these users.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should move the anchor a tags from around the words "Click here" to wrap around the words "information about batteries".
- testString: assert($('a').text().match(/^(information about batteries)$/g));
- - text: The a element should have an href attribute with a value of an empty string "".
- testString: assert($('a').attr('href') === '');
- - text: The a element should have a closing tag.
- testString: assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(//g).length);
+The link text that Camper Cat is using is not very descriptive without the surrounding context. Move the anchor (`a`) tags so they wrap around the text "information about batteries" instead of "Click here".
+# --hints--
+
+Your code should move the anchor `a` tags from around the words "Click here" to wrap around the words "information about batteries".
+
+```js
+assert(
+ $('a')
+ .text()
+ .match(/^(information about batteries)$/g)
+);
```
-
+The `a` element should have an `href` attribute with a value of an empty string `""`.
-## Challenge Seed
-
+```js
+assert($('a').attr('href') === '');
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -70,5 +72,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.md
index fce22783b8..1adcef881a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/c/cVJVkcZ'
forumTopicId: 301014
---
-## Description
-
-HTML5's audio element gives semantic meaning when it wraps sound or audio stream content in your markup. Audio content also needs a text alternative to be accessible to people who are deaf or hard of hearing. This can be done with nearby text on the page or a link to a transcript.
-The audio tag supports the controls attribute. This shows the browser default play, pause, and other controls, and supports keyboard functionality. This is a boolean attribute, meaning it doesn't need a value, its presence on the tag turns the setting on.
+# --description--
+
+HTML5's `audio` element gives semantic meaning when it wraps sound or audio stream content in your markup. Audio content also needs a text alternative to be accessible to people who are deaf or hard of hearing. This can be done with nearby text on the page or a link to a transcript.
+
+The `audio` tag supports the `controls` attribute. This shows the browser default play, pause, and other controls, and supports keyboard functionality. This is a boolean attribute, meaning it doesn't need a value, its presence on the tag turns the setting on.
+
Here's an example:
```html
@@ -19,43 +21,67 @@ Here's an example:
```
-Note: Multimedia content usually has both visual and auditory components. It needs synchronized captions and a transcript so users with visual and/or auditory impairments can access it. Generally, a web developer is not responsible for creating the captions or transcript, but needs to know to include them.
-
+**Note:** Multimedia content usually has both visual and auditory components. It needs synchronized captions and a transcript so users with visual and/or auditory impairments can access it. Generally, a web developer is not responsible for creating the captions or transcript, but needs to know to include them.
-## Instructions
-
-Time to take a break from Camper Cat and meet fellow camper Zersiax (@zersiax), a champion of accessibility and a screen reader user. To hear a clip of his screen reader in action, add an audio element after the p. Include the controls attribute. Then place a source tag inside the audio tags with the src attribute set to "https://s3.amazonaws.com/freecodecamp/screen-reader.mp3" and type attribute set to "audio/mpeg".
-Note: The audio clip may sound fast and be difficult to understand, but that is a normal speed for screen reader users.
-
+# --instructions--
-## Tests
-
+Time to take a break from Camper Cat and meet fellow camper Zersiax (@zersiax), a champion of accessibility and a screen reader user. To hear a clip of his screen reader in action, add an `audio` element after the `p`. Include the `controls` attribute. Then place a `source` tag inside the `audio` tags with the `src` attribute set to "`https://s3.amazonaws.com/freecodecamp/screen-reader.mp3`" and `type` attribute set to "audio/mpeg".
-```yml
-tests:
- - text: Your code should have one audio tag.
- testString: assert($('audio').length === 1);
- - text: Your audio element should have a closing tag.
- testString: assert(code.match(/<\/audio>/g).length === 1 && code.match(/[\s\S]*<\/audio>/g));
- - text: The audio tag should have the controls attribute.
- testString: assert($('audio').attr('controls'));
- - text: Your code should have one source tag.
- testString: assert($('source').length === 1);
- - text: Your source tag should be inside the audio tags.
- testString: assert($('audio').children('source').length === 1);
- - text: The value for the src attribute on the source tag should match the link in the instructions exactly.
- testString: assert($('source').attr('src') === 'https://s3.amazonaws.com/freecodecamp/screen-reader.mp3');
- - text: Your code should include a type attribute on the source tag with a value of audio/mpeg.
- testString: assert($('source').attr('type') === 'audio/mpeg');
+**Note:** The audio clip may sound fast and be difficult to understand, but that is a normal speed for screen reader users.
+# --hints--
+
+Your code should have one `audio` tag.
+
+```js
+assert($('audio').length === 1);
```
-
+Your `audio` element should have a closing tag.
-## Challenge Seed
-
+```js
+assert(
+ code.match(/<\/audio>/g).length === 1 &&
+ code.match(/[\s\S]*<\/audio>/g)
+);
+```
-
+The `audio` tag should have the `controls` attribute.
+
+```js
+assert($('audio').attr('controls'));
+```
+
+Your code should have one `source` tag.
+
+```js
+assert($('source').length === 1);
+```
+
+Your `source` tag should be inside the `audio` tags.
+
+```js
+assert($('audio').children('source').length === 1);
+```
+
+The value for the `src` attribute on the `source` tag should match the link in the instructions exactly.
+
+```js
+assert(
+ $('source').attr('src') ===
+ 'https://s3.amazonaws.com/freecodecamp/screen-reader.mp3'
+);
+```
+
+Your code should include a `type` attribute on the `source` tag with a value of audio/mpeg.
+
+```js
+assert($('source').attr('type') === 'audio/mpeg');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -71,14 +97,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -93,5 +112,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.md
index 31dec12039..a3c6347b8c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.md
@@ -6,11 +6,13 @@ videoUrl: 'https://scrimba.com/c/cGJMqtE'
forumTopicId: 301015
---
-## Description
-
-HTML5 introduced the figure element, along with the related figcaption. Used together, these items wrap a visual representation (like an image, diagram, or chart) along with its caption. This gives a two-fold accessibility boost by both semantically grouping related content, and providing a text alternative that explains the figure.
+# --description--
+
+HTML5 introduced the `figure` element, along with the related `figcaption`. Used together, these items wrap a visual representation (like an image, diagram, or chart) along with its caption. This gives a two-fold accessibility boost by both semantically grouping related content, and providing a text alternative that explains the `figure`.
+
For data visualizations like charts, the caption can be used to briefly note the trends or conclusions for users with visual impairments. Another challenge covers how to move a table version of the chart's data off-screen (using CSS) for screen reader users.
-Here's an example - note that the figcaption goes inside the figure tags and can be combined with other elements:
+
+Here's an example - note that the `figcaption` goes inside the `figure` tags and can be combined with other elements:
```html
@@ -22,39 +24,54 @@ Here's an example - note that the figcaption goes inside the
```
-
+# --instructions--
-## Instructions
-
-Camper Cat is hard at work creating a stacked bar chart showing the amount of time per week to spend training in stealth, combat, and weapons. Help him structure his page better by changing the div tag he used to a figure tag, and the p tag that surrounds the caption to a figcaption tag.
-
+Camper Cat is hard at work creating a stacked bar chart showing the amount of time per week to spend training in stealth, combat, and weapons. Help him structure his page better by changing the `div` tag he used to a `figure` tag, and the `p` tag that surrounds the caption to a `figcaption` tag.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should have one figure tag.
- testString: assert($('figure').length == 1);
- - text: Your code should have one figcaption tag.
- testString: assert($('figcaption').length == 1);
- - text: Your code should not have any div tags.
- testString: assert($('div').length == 0);
- - text: Your code should not have any p tags.
- testString: assert($('p').length == 0);
- - text: The figcaption should be a child of the figure tag.
- testString: assert($('figure').children('figcaption').length == 1);
- - text: Your figure element should have a closing tag.
- testString: assert(code.match(/<\/figure>/g) && code.match(/<\/figure>/g).length === code.match(//g).length);
+Your code should have one `figure` tag.
+```js
+assert($('figure').length == 1);
```
-
+Your code should have one `figcaption` tag.
-## Challenge Seed
-
+```js
+assert($('figcaption').length == 1);
+```
-
+Your code should not have any `div` tags.
+
+```js
+assert($('div').length == 0);
+```
+
+Your code should not have any `p` tags.
+
+```js
+assert($('p').length == 0);
+```
+
+The `figcaption` should be a child of the `figure` tag.
+
+```js
+assert($('figure').children('figcaption').length == 1);
+```
+
+Your `figure` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/figure>/g) &&
+ code.match(/<\/figure>/g).length === code.match(//g).length
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -100,14 +117,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -148,5 +158,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.md
index 895ae65a04..5a10645b57 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.md
@@ -6,12 +6,15 @@ videoUrl: 'https://scrimba.com/c/cGJMMAN'
forumTopicId: 301016
---
-## Description
-
+# --description--
+
Improving accessibility with semantic HTML markup applies to using both appropriate tag names as well as attributes. The next several challenges cover some important scenarios using attributes in forms.
-The label tag wraps the text for a specific form control item, usually the name or label for a choice. This ties meaning to the item and makes the form more readable. The for attribute on a label tag explicitly associates that label with the form control and is used by screen readers.
-You learned about radio buttons and their labels in a lesson in the Basic HTML section. In that lesson, we wrapped the radio button input element inside a label element along with the label text in order to make the text clickable. Another way to achieve this is by using the for attribute as explained in this lesson.
-The value of the for attribute must be the same as the value of the id attribute of the form control. Here's an example:
+
+The `label` tag wraps the text for a specific form control item, usually the name or label for a choice. This ties meaning to the item and makes the form more readable. The `for` attribute on a `label` tag explicitly associates that `label` with the form control and is used by screen readers.
+
+You learned about radio buttons and their labels in a lesson in the Basic HTML section. In that lesson, we wrapped the radio button input element inside a `label` element along with the label text in order to make the text clickable. Another way to achieve this is by using the `for` attribute as explained in this lesson.
+
+The value of the `for` attribute must be the same as the value of the `id` attribute of the form control. Here's an example:
```html
```
-
+# --instructions--
-## Instructions
-
-Camper Cat expects a lot of interest in his thoughtful blog posts and wants to include an email sign up form. Add a for attribute on the email label that matches the id on its input field.
-
+Camper Cat expects a lot of interest in his thoughtful blog posts and wants to include an email sign up form. Add a `for` attribute on the email `label` that matches the `id` on its `input` field.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should have a for attribute on the label tag that is not empty.
- testString: assert($('label').attr('for'));
- - text: Your for attribute value should match the id value on the email input.
- testString: assert($('label').attr('for') == 'email');
+Your code should have a `for` attribute on the `label` tag that is not empty.
+```js
+assert($('label').attr('for'));
```
-
+Your `for` attribute value should match the `id` value on the email `input`.
-## Challenge Seed
-
+```js
+assert($('label').attr('for') == 'email');
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -124,5 +116,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.md
index 52459961e3..6d412efb98 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.md
@@ -6,35 +6,33 @@ videoUrl: 'https://scrimba.com/c/cKb3nCq'
forumTopicId: 301017
---
-## Description
-
+# --description--
+
Low contrast between the foreground and background colors can make text difficult to read. Sufficient contrast improves the readability of your content, but what exactly does "sufficient" mean?
+
The Web Content Accessibility Guidelines (WCAG) recommend at least a 4.5 to 1 contrast ratio for normal text. The ratio is calculated by comparing the relative luminance values of two colors. This ranges from 1:1 for the same color, or no contrast, to 21:1 for white against black, the strongest contrast. There are many contrast checking tools available online that calculate this ratio for you.
-
-## Instructions
-
-Camper Cat's choice of light gray text on a white background for his recent blog post has a 1.5:1 contrast ratio, making it hard to read. Change the color of the text from the current gray (#D3D3D3) to a darker gray (#636363) to improve the contrast ratio to 6:1.
-
+# --instructions--
-## Tests
-
+Camper Cat's choice of light gray text on a white background for his recent blog post has a 1.5:1 contrast ratio, making it hard to read. Change the `color` of the text from the current gray (`#D3D3D3`) to a darker gray (`#636363`) to improve the contrast ratio to 6:1.
-```yml
-tests:
- - text: Your code should change the text color for the body to the darker gray.
- testString: assert($('body').css('color') == 'rgb(99, 99, 99)');
- - text: Your code should not change the background-color for the body.
- testString: assert($('body').css('background-color') == 'rgb(255, 255, 255)');
+# --hints--
+Your code should change the text `color` for the `body` to the darker gray.
+
+```js
+assert($('body').css('color') == 'rgb(99, 99, 99)');
```
-
+Your code should not change the `background-color` for the `body`.
-## Challenge Seed
-
+```js
+assert($('body').css('background-color') == 'rgb(255, 255, 255)');
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -86,5 +77,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.md
index 5438dd2f88..58d5656a18 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.md
@@ -6,37 +6,37 @@ videoUrl: 'https://scrimba.com/c/cPp7zuE'
forumTopicId: 301018
---
-## Description
-
-HTML5 introduced a number of new elements that give developers more options while also incorporating accessibility features. These tags include main, header, footer, nav, article, and section, among others.
-By default, a browser renders these elements similarly to the humble div. However, using them where appropriate gives additional meaning in your markup. The tag name alone can indicate the type of information it contains, which adds semantic meaning to that content. Assistive technologies can access this information to provide better page summary or navigation options to their users.
-The main element is used to wrap (you guessed it) the main content, and there should be only one per page. It's meant to surround the information that's related to the central topic of your page. It's not meant to include items that repeat across pages, like navigation links or banners.
-The main tag also has an embedded landmark feature that assistive technology can use to quickly navigate to the main content. If you've ever seen a "Jump to Main Content" link at the top of a page, using a main tag automatically gives assistive devices that functionality.
-
+# --description--
-## Instructions
-
-Camper Cat has some big ideas for his ninja weapons page. Help him set up his markup by adding opening and closing main tags between the header and footer (covered in other challenges). Keep the main tags empty for now.
-
+HTML5 introduced a number of new elements that give developers more options while also incorporating accessibility features. These tags include `main`, `header`, `footer`, `nav`, `article`, and `section`, among others.
-## Tests
-
+By default, a browser renders these elements similarly to the humble `div`. However, using them where appropriate gives additional meaning in your markup. The tag name alone can indicate the type of information it contains, which adds semantic meaning to that content. Assistive technologies can access this information to provide better page summary or navigation options to their users.
-```yml
-tests:
- - text: Your code should have one main tag.
- testString: assert($('main').length == 1);
- - text: The main tags should be between the closing header tag and the opening footer tag.
- testString: assert(code.match(/<\/header>\s*?\s*?<\/main>/gi));
+The `main` element is used to wrap (you guessed it) the main content, and there should be only one per page. It's meant to surround the information that's related to the central topic of your page. It's not meant to include items that repeat across pages, like navigation links or banners.
+The `main` tag also has an embedded landmark feature that assistive technology can use to quickly navigate to the main content. If you've ever seen a "Jump to Main Content" link at the top of a page, using a main tag automatically gives assistive devices that functionality.
+
+# --instructions--
+
+Camper Cat has some big ideas for his ninja weapons page. Help him set up his markup by adding opening and closing `main` tags between the `header` and `footer` (covered in other challenges). Keep the `main` tags empty for now.
+
+# --hints--
+
+Your code should have one `main` tag.
+
+```js
+assert($('main').length == 1);
```
-
+The `main` tags should be between the closing `header` tag and the opening `footer` tag.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/header>\s*?\s*?<\/main>/gi));
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -66,5 +59,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/know-when-alt-text-should-be-left-blank.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/know-when-alt-text-should-be-left-blank.md
index 45983d0e9d..f4d539b515 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/know-when-alt-text-should-be-left-blank.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/know-when-alt-text-should-be-left-blank.md
@@ -6,38 +6,39 @@ videoUrl: 'https://scrimba.com/c/cM9P4t2'
forumTopicId: 301019
---
-## Description
-
-In the last challenge, you learned that including an alt attribute when using img tags is mandatory. However, sometimes images are grouped with a caption already describing them, or are used for decoration only. In these cases alt text may seem redundant or unnecessary.
-In situations when an image is already explained with text content, or does not add meaning to a page, the img still needs an alt attribute, but it can be set to an empty string. Here's an example:
-<img src="visualDecoration.jpeg" alt="">
+# --description--
+
+In the last challenge, you learned that including an `alt` attribute when using `img` tags is mandatory. However, sometimes images are grouped with a caption already describing them, or are used for decoration only. In these cases `alt` text may seem redundant or unnecessary.
+
+In situations when an image is already explained with text content, or does not add meaning to a page, the `img` still needs an `alt` attribute, but it can be set to an empty string. Here's an example:
+
+``
+
Background images usually fall under the 'decorative' label as well. However, they are typically applied with CSS rules, and therefore not part of the markup screen readers process.
-Note: For images with a caption, you may still want to include alt text, since it helps search engines catalog the content of the image.
-
-## Instructions
-
-Camper Cat has coded a skeleton page for the blog part of his website. He's planning to add a visual break between his two articles with a decorative image of a samurai sword. Add an alt attribute to the img tag and set it to an empty string. (Note that the image src doesn't link to an actual file - don't worry that there are no swords showing in the display.)
-
+**Note:** For images with a caption, you may still want to include `alt` text, since it helps search engines catalog the content of the image.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your img tag should have an alt attribute.
- testString: assert(!($('img').attr('alt') == undefined));
- - text: The alt attribute should be set to an empty string.
- testString: assert($('img').attr('alt') == '');
+Camper Cat has coded a skeleton page for the blog part of his website. He's planning to add a visual break between his two articles with a decorative image of a samurai sword. Add an `alt` attribute to the `img` tag and set it to an empty string. (Note that the image `src` doesn't link to an actual file - don't worry that there are no swords showing in the display.)
+# --hints--
+
+Your `img` tag should have an `alt` attribute.
+
+```js
+assert(!($('img').attr('alt') == undefined));
```
-
+The `alt` attribute should be set to an empty string.
-## Challenge Seed
-
+```js
+assert($('img').attr('alt') == '');
+```
-
+# --seed--
+
+## --seed-contents--
```html
Deep Thoughts with Master Camper Cat
@@ -54,14 +55,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
Deep Thoughts with Master Camper Cat
@@ -77,5 +71,3 @@ tests:
To Come...
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.md
index ce899c3abe..8fc9ee5c5a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/c/cJ8QGkhJ'
forumTopicId: 301020
---
-## Description
-
+# --description--
+
Have you noticed that all of the applied accessibility challenges so far haven't used any CSS? This is to show the importance of a logical document outline, and using semantically meaningful tags around your content before introducing the visual design aspect.
+
However, CSS's magic can also improve accessibility on your page when you want to visually hide content meant only for screen readers. This happens when information is in a visual format (like a chart), but screen reader users need an alternative presentation (like a table) to access the data. CSS is used to position the screen reader-only elements off the visual area of the browser window.
+
Here's an example of the CSS rules that accomplish this:
```css
@@ -23,40 +25,46 @@ Here's an example of the CSS rules that accomplish this:
}
```
-Note: The following CSS approaches will NOT do the same thing:
+**Note:** The following CSS approaches will NOT do the same thing:
+
display: none; or visibility: hidden; hides content for everyone, including screen reader users
Zero values for pixel sizes, such as width: 0px; height: 0px; removes that element from the flow of your document, meaning screen readers will ignore it
-
-## Instructions
-
-Camper Cat created a really cool stacked bar chart for his training page, and put the data into a table for his visually impaired users. The table already has an sr-only class, but the CSS rules aren't filled in yet. Give the position an absolute value, the left a -10000px value, and the width and height both 1px values.
-
+# --instructions--
-## Tests
-
+Camper Cat created a really cool stacked bar chart for his training page, and put the data into a table for his visually impaired users. The table already has an `sr-only` class, but the CSS rules aren't filled in yet. Give the `position` an absolute value, the `left` a -10000px value, and the `width` and `height` both 1px values.
-```yml
-tests:
- - text: Your code should set the position property of the sr-only class to a value of absolute.
- testString: assert($('.sr-only').css('position') == 'absolute');
- - text: Your code should set the left property of the sr-only class to a value of -10000px.
- testString: assert($('.sr-only').css('left') == '-10000px');
- - text: Your code should set the width property of the sr-only class to a value of 1 pixel.
- testString: assert(code.match(/width:\s*?1px/gi));
- - text: Your code should set the height property of the sr-only class to a value of 1 pixel.
- testString: assert(code.match(/height:\s*?1px/gi));
+# --hints--
+Your code should set the `position` property of the `sr-only` class to a value of absolute.
+
+```js
+assert($('.sr-only').css('position') == 'absolute');
```
-
+Your code should set the `left` property of the `sr-only` class to a value of -10000px.
-## Challenge Seed
-
+```js
+assert($('.sr-only').css('left') == '-10000px');
+```
-
+Your code should set the `width` property of the `sr-only` class to a value of 1 pixel.
+
+```js
+assert(code.match(/width:\s*?1px/gi));
+```
+
+Your code should set the `height` property of the `sr-only` class to a value of 1 pixel.
+
+```js
+assert(code.match(/height:\s*?1px/gi));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -145,14 +153,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -240,5 +241,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.md
index ba4f2fb881..107cd15378 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.md
@@ -6,41 +6,49 @@ videoUrl: 'https://scrimba.com/c/cQvmaTp'
forumTopicId: 301021
---
-## Description
-
-HTML offers the accesskey attribute to specify a shortcut key to activate or bring focus to an element. This can make navigation more efficient for keyboard-only users.
+# --description--
+
+HTML offers the `accesskey` attribute to specify a shortcut key to activate or bring focus to an element. This can make navigation more efficient for keyboard-only users.
+
HTML5 allows this attribute to be used on any element, but it's particularly useful when it's used with interactive ones. This includes links, buttons, and form controls.
+
Here's an example:
-<button accesskey="b">Important Button</button>
-
-## Instructions
-
-Camper Cat wants the links around the two blog article titles to have keyboard shortcuts so his site's users can quickly navigate to the full story. Add an accesskey attribute to both links and set the first one to "g" (for Garfield) and the second one to "c" (for Chuck Norris).
-
+``
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should add an accesskey attribute to the a tag with the id of "first".
- testString: assert($('#first').attr('accesskey'));
- - text: Your code should add an accesskey attribute to the a tag with the id of "second".
- testString: assert($('#second').attr('accesskey'));
- - text: Your code should set the accesskey attribute on the a tag with the id of "first" to "g". Note that case matters.
- testString: assert($('#first').attr('accesskey') == 'g');
- - text: Your code should set the accesskey attribute on the a tag with the id of "second" to "c". Note that case matters.
- testString: assert($('#second').attr('accesskey') == 'c');
+Camper Cat wants the links around the two blog article titles to have keyboard shortcuts so his site's users can quickly navigate to the full story. Add an `accesskey` attribute to both links and set the first one to "g" (for Garfield) and the second one to "c" (for Chuck Norris).
+# --hints--
+
+Your code should add an `accesskey` attribute to the `a` tag with the `id` of "first".
+
+```js
+assert($('#first').attr('accesskey'));
```
-
+Your code should add an `accesskey` attribute to the `a` tag with the `id` of "second".
-## Challenge Seed
-
+```js
+assert($('#second').attr('accesskey'));
+```
-
+Your code should set the `accesskey` attribute on the `a` tag with the `id` of "first" to "g". Note that case matters.
+
+```js
+assert($('#first').attr('accesskey') == 'g');
+```
+
+Your code should set the `accesskey` attribute on the `a` tag with the `id` of "second" to "c". Note that case matters.
+
+```js
+assert($('#second').attr('accesskey') == 'c');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -67,14 +75,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -100,5 +101,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-footer-landmark.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-footer-landmark.md
index 4dad3c6498..caf359a82c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-footer-landmark.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-footer-landmark.md
@@ -6,36 +6,37 @@ videoUrl: 'https://scrimba.com/c/crVrDh8'
forumTopicId: 301022
---
-## Description
-
-Similar to header and nav, the footer element has a built-in landmark feature that allows assistive devices to quickly navigate to it. It's primarily used to contain copyright information or links to related documents that usually sit at the bottom of a page.
-
+# --description--
-## Instructions
-
-Camper Cat's training page is making good progress. Change the div he used to wrap his copyright information at the bottom of the page to a footer element.
-
+Similar to `header` and `nav`, the `footer` element has a built-in landmark feature that allows assistive devices to quickly navigate to it. It's primarily used to contain copyright information or links to related documents that usually sit at the bottom of a page.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should have one footer tag.
- testString: assert($('footer').length == 1);
- - text: Your code should not have any div tags.
- testString: assert($('div').length == 0);
- - text: Your code should have an opening and closing footer tag.
- testString: assert(code.match(/
+Your code should not have any `div` tags.
-## Challenge Seed
-
+```js
+assert($('div').length == 0);
+```
-
+Your code should have an opening and closing `footer` tag.
+
+```js
+assert(code.match(/
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -119,5 +113,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-header-landmark.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-header-landmark.md
index 18bc8de59d..1cf400a538 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-header-landmark.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-header-landmark.md
@@ -6,40 +6,50 @@ videoUrl: 'https://scrimba.com/c/cB76vtv'
forumTopicId: 301023
---
-## Description
-
-The next HTML5 element that adds semantic meaning and improves accessibility is the header tag. It's used to wrap introductory information or navigation links for its parent tag and works well around content that's repeated at the top on multiple pages.
-header shares the embedded landmark feature you saw with main, allowing assistive technologies to quickly navigate to that content.
-Note: The header is meant for use in the body tag of your HTML document. This is different than the head element, which contains the page's title, meta information, etc.
-
+# --description--
-## Instructions
-
-Camper Cat is writing some great articles about ninja training, and wants to add a page for them to his site. Change the top div that currently contains the h1 to a header tag instead.
-
+The next HTML5 element that adds semantic meaning and improves accessibility is the `header` tag. It's used to wrap introductory information or navigation links for its parent tag and works well around content that's repeated at the top on multiple pages.
-## Tests
-
+`header` shares the embedded landmark feature you saw with `main`, allowing assistive technologies to quickly navigate to that content.
-```yml
-tests:
- - text: Your code should have one header tag.
- testString: assert($('header').length == 1);
- - text: Your header tags should wrap around the h1.
- testString: assert($('header').children('h1').length == 1);
- - text: Your code should not have any div tags.
- testString: assert($('div').length == 0);
- - text: Your header element should have a closing tag.
- testString: assert(code.match(/<\/header>/g) && code.match(/<\/header>/g).length === code.match(//g).length);
+**Note:** The `header` is meant for use in the `body` tag of your HTML document. This is different than the `head` element, which contains the page's title, meta information, etc.
+# --instructions--
+
+Camper Cat is writing some great articles about ninja training, and wants to add a page for them to his site. Change the top `div` that currently contains the `h1` to a `header` tag instead.
+
+# --hints--
+
+Your code should have one `header` tag.
+
+```js
+assert($('header').length == 1);
```
-
+Your `header` tags should wrap around the `h1`.
-## Challenge Seed
-
+```js
+assert($('header').children('h1').length == 1);
+```
-
+Your code should not have any `div` tags.
+
+```js
+assert($('div').length == 0);
+```
+
+Your `header` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/header>/g) &&
+ code.match(/<\/header>/g).length === code.match(//g).length
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -69,14 +79,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -105,5 +108,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-nav-landmark.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-nav-landmark.md
index d99b3a1629..4439594373 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-nav-landmark.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-nav-landmark.md
@@ -6,39 +6,48 @@ videoUrl: 'https://scrimba.com/c/czVwWSv'
forumTopicId: 301024
---
-## Description
-
-The nav element is another HTML5 item with the embedded landmark feature for easy screen reader navigation. This tag is meant to wrap around the main navigation links in your page.
-If there are repeated site links at the bottom of the page, it isn't necessary to markup those with a nav tag as well. Using a footer (covered in the next challenge) is sufficient.
-
+# --description--
-## Instructions
-
-Camper Cat included navigation links at the top of his training page, but wrapped them in a div. Change the div to a nav tag to improve the accessibility on his page.
-
+The `nav` element is another HTML5 item with the embedded landmark feature for easy screen reader navigation. This tag is meant to wrap around the main navigation links in your page.
-## Tests
-
+If there are repeated site links at the bottom of the page, it isn't necessary to markup those with a `nav` tag as well. Using a `footer` (covered in the next challenge) is sufficient.
-```yml
-tests:
- - text: Your code should have one nav tag.
- testString: assert($('nav').length == 1);
- - text: Your nav tags should wrap around the ul and its list items.
- testString: assert($('nav').children('ul').length == 1);
- - text: Your code should not have any div tags.
- testString: assert($('div').length == 0);
- - text: Your nav element should have a closing tag.
- testString: assert(code.match(/<\/nav>/g) && code.match(/<\/nav>/g).length === code.match(/
+Your `nav` tags should wrap around the `ul` and its list items.
-## Challenge Seed
-
+```js
+assert($('nav').children('ul').length == 1);
+```
-
+Your code should not have any `div` tags.
+
+```js
+assert($('div').length == 0);
+```
+
+Your `nav` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/nav>/g) &&
+ code.match(/<\/nav>/g).length === code.match(/
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -116,5 +118,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.md
index 8644b41b8e..a301791361 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.md
@@ -6,39 +6,61 @@ videoUrl: 'https://scrimba.com/c/cmzMgtz'
forumTopicId: 301025
---
-## Description
-
-Continuing with the date theme, HTML5 also introduced the time element along with a datetime attribute to standardize times. This is an inline element that can wrap a date or time on a page. A valid format of that date is held by the datetime attribute. This is the value accessed by assistive devices. It helps avoid confusion by stating a standardized version of a time, even if it's written in an informal or colloquial manner in the text.
+# --description--
+
+Continuing with the date theme, HTML5 also introduced the `time` element along with a `datetime` attribute to standardize times. This is an inline element that can wrap a date or time on a page. A valid format of that date is held by the `datetime` attribute. This is the value accessed by assistive devices. It helps avoid confusion by stating a standardized version of a time, even if it's written in an informal or colloquial manner in the text.
+
Here's an example:
-<p>Master Camper Cat officiated the cage match between Goro and Scorpion <time datetime="2013-02-13">last Wednesday</time>, which ended in a draw.</p>
-
-## Instructions
-
-Camper Cat's Mortal Kombat survey results are in! Wrap a time tag around the text "Thursday, September 15<sup>th</sup>" and add a datetime attribute to it set to "2016-09-15".
-
+`
Master Camper Cat officiated the cage match between Goro and Scorpion , which ended in a draw.
`
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should have a p element which includes the text Thank you to everyone for responding to Master Camper Cat's survey. and include a time element.
- testString: assert(timeElement.length);
- - text: Your added time tags should wrap around the text Thursday, September 15<sup>th</sup>.
- testString: assert(timeElement.length && $(timeElement).html().trim() === "Thursday, September 15th");
- - text: Your added time tag should have a datetime attribute that is not empty.
- testString: assert(datetimeAttr && datetimeAttr.length);
- - text: Your added datetime attribute should be set to a value of 2016-09-15.
- testString: assert(datetimeAttr === "2016-09-15");
+Camper Cat's Mortal Kombat survey results are in! Wrap a `time` tag around the text "Thursday, September 15<sup>th</sup>" and add a `datetime` attribute to it set to "2016-09-15".
+
+# --hints--
+
+Your code should have a `p` element which includes the text `Thank you to everyone for responding to Master Camper Cat's survey.` and include a `time` element.
+
+```js
+assert(timeElement.length);
```
-
+Your added `time` tags should wrap around the text `Thursday, September 15th`.
-## Challenge Seed
-
+```js
+assert(
+ timeElement.length &&
+ $(timeElement).html().trim() === 'Thursday, September 15th'
+);
+```
-
+Your added `time` tag should have a `datetime` attribute that is not empty.
+
+```js
+assert(datetimeAttr && datetimeAttr.length);
+```
+
+Your added `datetime` attribute should be set to a value of `2016-09-15`.
+
+```js
+assert(datetimeAttr === '2016-09-15');
+```
+
+# --seed--
+
+## --after-user-code--
+
+```html
+
+```
+
+## --seed-contents--
```html
@@ -74,25 +96,7 @@ tests:
```
-
-
-
-
-```html
-
-```
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -123,5 +127,3 @@ const datetimeAttr = $(timeElement).attr("datetime");
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.md
index f293236ecb..0049b76786 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.md
@@ -6,42 +6,53 @@ videoUrl: 'https://scrimba.com/c/cqVEktm'
forumTopicId: 301026
---
-## Description
-
-Headings (h1 through h6 elements) are workhorse tags that help provide structure and labeling to your content. Screen readers can be set to read only the headings on a page so the user gets a summary. This means it is important for the heading tags in your markup to have semantic meaning and relate to each other, not be picked merely for their size values.
-Semantic meaning means that the tag you use around content indicates the type of information it contains.
+# --description--
+
+Headings (`h1` through `h6` elements) are workhorse tags that help provide structure and labeling to your content. Screen readers can be set to read only the headings on a page so the user gets a summary. This means it is important for the heading tags in your markup to have semantic meaning and relate to each other, not be picked merely for their size values.
+
+*Semantic meaning* means that the tag you use around content indicates the type of information it contains.
+
If you were writing a paper with an introduction, a body, and a conclusion, it wouldn't make much sense to put the conclusion as a subsection of the body in your outline. It should be its own section. Similarly, the heading tags in a webpage need to go in order and indicate the hierarchical relationships of your content.
+
Headings with equal (or higher) rank start new implied sections, headings with lower rank start subsections of the previous one.
-As an example, a page with an h2 element followed by several subsections labeled with h4 tags would confuse a screen reader user. With six choices, it's tempting to use a tag because it looks better in a browser, but you can use CSS to edit the relative sizing.
-One final point, each page should always have one (and only one) h1 element, which is the main subject of your content. This and the other headings are used in part by search engines to understand the topic of the page.
-
-## Instructions
-
-Camper Cat wants a page on his site dedicated to becoming a ninja. Help him fix the headings so his markup gives semantic meaning to the content, and shows the proper parent-child relationships of his sections. Change all the h5 tags to the proper heading level to indicate they are subsections of the h2 ones. Use h3 tags for the purpose.
-
+As an example, a page with an `h2` element followed by several subsections labeled with `h4` tags would confuse a screen reader user. With six choices, it's tempting to use a tag because it looks better in a browser, but you can use CSS to edit the relative sizing.
-## Tests
-
+One final point, each page should always have one (and only one) `h1` element, which is the main subject of your content. This and the other headings are used in part by search engines to understand the topic of the page.
-```yml
-tests:
- - text: Your code should have 6 h3 tags.
- testString: assert($("h3").length === 6);
- - text: Your code should have 6 h3 closing tags.
- testString: assert((code.match(/\/h3/g) || []).length===6);
- - text: Your code should not have any h5 tags.
- testString: assert($("h5").length === 0);
- - text: Your code should not have any h5 closing tags.
- testString: assert(/\/h5/.test(code)===false);
+# --instructions--
+
+Camper Cat wants a page on his site dedicated to becoming a ninja. Help him fix the headings so his markup gives semantic meaning to the content, and shows the proper parent-child relationships of his sections. Change all the `h5` tags to the proper heading level to indicate they are subsections of the `h2` ones. Use `h3` tags for the purpose.
+
+# --hints--
+
+Your code should have 6 `h3` tags.
+
+```js
+assert($('h3').length === 6);
```
-
+Your code should have 6 `h3` closing tags.
-## Challenge Seed
-
+```js
+assert((code.match(/\/h3/g) || []).length === 6);
+```
-
+Your code should not have any `h5` tags.
+
+```js
+assert($('h5').length === 0);
+```
+
+Your code should not have any `h5` closing tags.
+
+```js
+assert(/\/h5/.test(code) === false);
+```
+
+# --seed--
+
+## --seed-contents--
```html
How to Become a Ninja
@@ -60,14 +71,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
How to Become a Ninja
@@ -85,5 +89,3 @@ tests:
How to Simplify your Life
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-add-keyboard-focus-to-an-element.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-add-keyboard-focus-to-an-element.md
index d2c721debd..a36c059836 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-add-keyboard-focus-to-an-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-add-keyboard-focus-to-an-element.md
@@ -6,37 +6,37 @@ videoUrl: 'https://scrimba.com/c/cmzMDHW'
forumTopicId: 301027
---
-## Description
-
-The HTML tabindex attribute has three distinct functions relating to an element's keyboard focus. When it's on a tag, it indicates that element can be focused on. The value (an integer that's positive, negative, or zero) determines the behavior.
-Certain elements, such as links and form controls, automatically receive keyboard focus when a user tabs through a page. It's in the same order as the elements come in the HTML source markup. This same functionality can be given to other elements, such as div, span, and p, by placing a tabindex="0" attribute on them. Here's an example:
-<div tabindex="0">I need keyboard focus!</div>
-Note: A negative tabindex value (typically -1) indicates that an element is focusable, but is not reachable by the keyboard. This method is generally used to bring focus to content programmatically (like when a div used for a pop-up window is activated), and is beyond the scope of these challenges.
-
+# --description--
-## Instructions
-
-Camper Cat created a new survey to collect information about his users. He knows input fields automatically get keyboard focus, but he wants to make sure his keyboard users pause at the instructions while tabbing through the items. Add a tabindex attribute to the p tag and set its value to "0". Bonus - using tabindex also enables the CSS pseudo-class :focus to work on the p tag.
-
+The HTML `tabindex` attribute has three distinct functions relating to an element's keyboard focus. When it's on a tag, it indicates that element can be focused on. The value (an integer that's positive, negative, or zero) determines the behavior.
-## Tests
-
+Certain elements, such as links and form controls, automatically receive keyboard focus when a user tabs through a page. It's in the same order as the elements come in the HTML source markup. This same functionality can be given to other elements, such as `div`, `span`, and `p`, by placing a `tabindex="0"` attribute on them. Here's an example:
-```yml
-tests:
- - text: Your code should add a tabindex attribute to the p tag that holds the form instructions.
- testString: assert($('p').attr('tabindex'));
- - text: Your code should set the tabindex attribute on the p tag to a value of 0.
- testString: assert($('p').attr('tabindex') == '0');
+`
I need keyboard focus!
`
+**Note:** A negative `tabindex` value (typically -1) indicates that an element is focusable, but is not reachable by the keyboard. This method is generally used to bring focus to content programmatically (like when a `div` used for a pop-up window is activated), and is beyond the scope of these challenges.
+
+# --instructions--
+
+Camper Cat created a new survey to collect information about his users. He knows input fields automatically get keyboard focus, but he wants to make sure his keyboard users pause at the instructions while tabbing through the items. Add a `tabindex` attribute to the `p` tag and set its value to `"0"`. Bonus - using `tabindex` also enables the CSS pseudo-class `:focus` to work on the `p` tag.
+
+# --hints--
+
+Your code should add a `tabindex` attribute to the `p` tag that holds the form instructions.
+
+```js
+assert($('p').attr('tabindex'));
```
-
+Your code should set the `tabindex` attribute on the `p` tag to a value of 0.
-## Challenge Seed
-
+```js
+assert($('p').attr('tabindex') == '0');
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -146,5 +139,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-specify-the-order-of-keyboard-focus-for-several-elements.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-specify-the-order-of-keyboard-focus-for-several-elements.md
index 734fca9a9e..1a5c40025c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-specify-the-order-of-keyboard-focus-for-several-elements.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/use-tabindex-to-specify-the-order-of-keyboard-focus-for-several-elements.md
@@ -6,43 +6,53 @@ videoUrl: 'https://scrimba.com/c/cmzRRcb'
forumTopicId: 301028
---
-## Description
-
-The tabindex attribute also specifies the exact tab order of elements. This is achieved when the value of the attribute is set to a positive number of 1 or higher.
-Setting a tabindex="1" will bring keyboard focus to that element first. Then it cycles through the sequence of specified tabindex values (2, 3, etc.), before moving to default and tabindex="0" items.
+# --description--
+
+The `tabindex` attribute also specifies the exact tab order of elements. This is achieved when the value of the attribute is set to a positive number of 1 or higher.
+
+Setting a `tabindex="1"` will bring keyboard focus to that element first. Then it cycles through the sequence of specified `tabindex` values (2, 3, etc.), before moving to default and `tabindex="0"` items.
+
It's important to note that when the tab order is set this way, it overrides the default order (which uses the HTML source). This may confuse users who are expecting to start navigation from the top of the page. This technique may be necessary in some circumstances, but in terms of accessibility, take care before applying it.
+
Here's an example:
-<div tabindex="1">I get keyboard focus, and I get it first!</div>
-<div tabindex="2">I get keyboard focus, and I get it second!</div>
-
-## Instructions
-
-Camper Cat has a search field on his Inspirational Quotes page that he plans to position in the upper right corner with CSS. He wants the search input and submit input form controls to be the first two items in the tab order. Add a tabindex attribute set to "1" to the search input, and a tabindex attribute set to "2" to the submit input.
-
+`
I get keyboard focus, and I get it first!
`
-## Tests
-
+`
I get keyboard focus, and I get it second!
`
-```yml
-tests:
- - text: Your code should add a tabindex attribute to the search input tag.
- testString: assert($('#search').attr('tabindex'));
- - text: Your code should add a tabindex attribute to the submit input tag.
- testString: assert($('#submit').attr('tabindex'));
- - text: Your code should set the tabindex attribute on the search input tag to a value of 1.
- testString: assert($('#search').attr('tabindex') == '1');
- - text: Your code should set the tabindex attribute on the submit input tag to a value of 2.
- testString: assert($('#submit').attr('tabindex') == '2');
+# --instructions--
+Camper Cat has a search field on his Inspirational Quotes page that he plans to position in the upper right corner with CSS. He wants the search `input` and submit `input` form controls to be the first two items in the tab order. Add a `tabindex` attribute set to `"1"` to the search `input`, and a `tabindex` attribute set to `"2"` to the submit `input`.
+
+# --hints--
+
+Your code should add a `tabindex` attribute to the search `input` tag.
+
+```js
+assert($('#search').attr('tabindex'));
```
-
+Your code should add a `tabindex` attribute to the submit `input` tag.
-## Challenge Seed
-
+```js
+assert($('#submit').attr('tabindex'));
+```
-
+Your code should set the `tabindex` attribute on the search `input` tag to a value of 1.
+
+```js
+assert($('#search').attr('tabindex') == '1');
+```
+
+Your code should set the `tabindex` attribute on the submit `input` tag to a value of 2.
+
+```js
+assert($('#submit').attr('tabindex') == '2');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -78,14 +88,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -120,5 +123,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-content-in-the-article-element.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-content-in-the-article-element.md
index a31045de81..baf00be313 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-content-in-the-article-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-content-in-the-article-element.md
@@ -6,12 +6,16 @@ videoUrl: 'https://scrimba.com/c/cPp79S3'
forumTopicId: 301029
---
-## Description
-
-article is another one of the new HTML5 elements that adds semantic meaning to your markup. article is a sectioning element, and is used to wrap independent, self-contained content. The tag works well with blog entries, forum posts, or news articles.
+# --description--
+
+`article` is another one of the new HTML5 elements that adds semantic meaning to your markup. `article` is a sectioning element, and is used to wrap independent, self-contained content. The tag works well with blog entries, forum posts, or news articles.
+
Determining whether content can stand alone is usually a judgement call, but there are a couple simple tests you can use. Ask yourself if you removed all surrounding context, would that content still make sense? Similarly for text, would the content hold up if it were in an RSS feed?
+
Remember that folks using assistive technologies rely on organized, semantically meaningful markup to better understand your work.
-Note about section and div The section element is also new with HTML5, and has a slightly different semantic meaning than article. An article is for standalone content, and a section is for grouping thematically related content. They can be used within each other, as needed. For example, if a book is the article, then each chapter is a section. When there's no relationship between groups of content, then use a div.
+
+**Note about `section` and `div`**
+The `section` element is also new with HTML5, and has a slightly different semantic meaning than `article`. An `article` is for standalone content, and a `section` is for grouping thematically related content. They can be used within each other, as needed. For example, if a book is the `article`, then each chapter is a `section`. When there's no relationship between groups of content, then use a `div`.
```html
- groups content
@@ -19,31 +23,27 @@ Remember that folks using assistive technologies rely on organized, semantically
- groups independent, self-contained content
```
-
+# --instructions--
-## Instructions
-
-Camper Cat used article tags to wrap the posts on his blog page, but he forgot to use them around the top one. Change the div tag to use an article tag instead.
-
+Camper Cat used `article` tags to wrap the posts on his blog page, but he forgot to use them around the top one. Change the `div` tag to use an `article` tag instead.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should have three article tags.
- testString: assert($('article').length == 3);
- - text: Your code should not have any div tags.
- testString: assert($('div').length == 0);
+Your code should have three `article` tags.
+```js
+assert($('article').length == 3);
```
-
+Your code should not have any `div` tags.
-## Challenge Seed
-
+```js
+assert($('div').length == 0);
+```
-
+# --seed--
+
+## --seed-contents--
```html
Deep Thoughts with Master Camper Cat
@@ -69,14 +69,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
Deep Thoughts with Master Camper Cat
@@ -101,5 +94,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-radio-buttons-in-a-fieldset-element-for-better-accessibility.md b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-radio-buttons-in-a-fieldset-element-for-better-accessibility.md
index 651042e5c3..f95d0d9ede 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-radio-buttons-in-a-fieldset-element-for-better-accessibility.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-accessibility/wrap-radio-buttons-in-a-fieldset-element-for-better-accessibility.md
@@ -6,11 +6,14 @@ videoUrl: 'https://scrimba.com/c/cVJVefw'
forumTopicId: 301030
---
-## Description
-
-The next form topic covers accessibility of radio buttons. Each choice is given a label with a for attribute tying to the id of the corresponding item as covered in the last challenge. Since radio buttons often come in a group where the user must choose one, there's a way to semantically show the choices are part of a set.
-The fieldset tag surrounds the entire grouping of radio buttons to achieve this. It often uses a legend tag to provide a description for the grouping, which is read by screen readers for each choice in the fieldset element.
-The fieldset wrapper and legend tag are not necessary when the choices are self-explanatory, like a gender selection. Using a label with the for attribute for each radio button is sufficient.
+# --description--
+
+The next form topic covers accessibility of radio buttons. Each choice is given a `label` with a `for` attribute tying to the `id` of the corresponding item as covered in the last challenge. Since radio buttons often come in a group where the user must choose one, there's a way to semantically show the choices are part of a set.
+
+The `fieldset` tag surrounds the entire grouping of radio buttons to achieve this. It often uses a `legend` tag to provide a description for the grouping, which is read by screen readers for each choice in the `fieldset` element.
+
+The `fieldset` wrapper and `legend` tag are not necessary when the choices are self-explanatory, like a gender selection. Using a `label` with the `for` attribute for each radio button is sufficient.
+
Here's an example:
```html
@@ -27,37 +30,48 @@ Here's an example:
```
-
+# --instructions--
-## Instructions
-
-Camper Cat wants information about the ninja level of his users when they sign up for his email list. He's added a set of radio buttons and learned from our last lesson to use label tags with for attributes for each choice. Go Camper Cat! However, his code still needs some help. Change the div tag surrounding the radio buttons to a fieldset tag, and change the p tag inside it to a legend.
-
+Camper Cat wants information about the ninja level of his users when they sign up for his email list. He's added a set of radio buttons and learned from our last lesson to use label tags with `for` attributes for each choice. Go Camper Cat! However, his code still needs some help. Change the `div` tag surrounding the radio buttons to a `fieldset` tag, and change the `p` tag inside it to a `legend`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should have a fieldset tag around the radio button set.
- testString: assert($('fieldset').length == 1);
- - text: The fieldset element should have a closing tag.
- testString: assert(code.match(/<\/fieldset>/g) && code.match(/<\/fieldset>/g).length === code.match(/
+The `fieldset` element should have a closing tag.
-## Challenge Seed
-
+```js
+assert(
+ code.match(/<\/fieldset>/g) &&
+ code.match(/<\/fieldset>/g).length === code.match(/
-
-## Solution
-
+# --solutions--
```html
@@ -155,5 +162,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.md
index 6fa234d64a..8973ddfb68 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/c/cvVZdUd'
forumTopicId: 301031
---
-## Description
-
-The box-shadow property applies one or more shadows to an element.
-The box-shadow property takes values for
+# --description--
+
+The `box-shadow` property applies one or more shadows to an element.
+
+The `box-shadow` property takes values for
+
offset-x (how far to push the shadow horizontally from the element),
offset-y (how far to push the shadow vertically from the element),
@@ -17,39 +19,42 @@ The box-shadow property takes values for
spread-radius and
color, in that order.
-The blur-radius and spread-radius values are optional.
-Multiple box-shadows can be created by using commas to separate properties of each box-shadow element.
+
+The `blur-radius` and `spread-radius` values are optional.
+
+Multiple box-shadows can be created by using commas to separate properties of each `box-shadow` element.
+
Here's an example of the CSS to create multiple shadows with some blur, at mostly-transparent black colors:
```css
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
```
-
+# --instructions--
-## Instructions
-
-The element now has an id of thumbnail. With this selector, use the example CSS values above to place a box-shadow on the card.
-
+The element now has an id of `thumbnail`. With this selector, use the example CSS values above to place a `box-shadow` on the card.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should add a box-shadow property for the thumbnail id.
- testString: assert(code.match(/#thumbnail\s*?{\s*?box-shadow/g));
- - text: You should use the given CSS for the box-shadow value.
- testString: assert(code.match(/box-shadow:\s*?0\s+?10px\s+?20px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.19\)\s*?,\s*?0\s+?6px\s+?6px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.23\)/gi));
+Your code should add a `box-shadow` property for the `thumbnail` id.
+```js
+assert(code.match(/#thumbnail\s*?{\s*?box-shadow/g));
```
-
+You should use the given CSS for the `box-shadow` value.
-## Challenge Seed
-
+```js
+assert(
+ code.match(
+ /box-shadow:\s*?0\s+?10px\s+?20px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.19\)\s*?,\s*?0\s+?6px\s+?6px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.23\)/gi
+ )
+);
+```
-
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.md
index 7fa0c9c62a..951bdd930e 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.md
@@ -6,47 +6,65 @@ videoUrl: 'https://scrimba.com/c/cPp38TZ'
forumTopicId: 301036
---
-## Description
-
-Colors have several characteristics including hue, saturation, and lightness. CSS3 introduced the hsl() property as an alternative way to pick a color by directly stating these characteristics.
-Hue is what people generally think of as 'color'. If you picture a spectrum of colors starting with red on the left, moving through green in the middle, and blue on right, the hue is where a color fits along this line. In hsl(), hue uses a color wheel concept instead of the spectrum, where the angle of the color on the circle is given as a value between 0 and 360.
-Saturation is the amount of gray in a color. A fully saturated color has no gray in it, and a minimally saturated color is almost completely gray. This is given as a percentage with 100% being fully saturated.
-Lightness is the amount of white or black in a color. A percentage is given ranging from 0% (black) to 100% (white), where 50% is the normal color.
-Here are a few examples of using hsl() with fully-saturated, normal lightness colors:
-
Color
HSL
red
hsl(0, 100%, 50%)
yellow
hsl(60, 100%, 50%)
green
hsl(120, 100%, 50%)
cyan
hsl(180, 100%, 50%)
blue
hsl(240, 100%, 50%)
magenta
hsl(300, 100%, 50%)
-
+# --description--
-## Instructions
-
-Change the background-color of each div element based on the class names (green, cyan, or blue) using hsl(). All three should have full saturation and normal lightness.
-
+Colors have several characteristics including hue, saturation, and lightness. CSS3 introduced the `hsl()` property as an alternative way to pick a color by directly stating these characteristics.
-## Tests
-
+**Hue** is what people generally think of as 'color'. If you picture a spectrum of colors starting with red on the left, moving through green in the middle, and blue on right, the hue is where a color fits along this line. In `hsl()`, hue uses a color wheel concept instead of the spectrum, where the angle of the color on the circle is given as a value between 0 and 360.
-```yml
-tests:
- - text: Your code should use the hsl() property to declare the color green.
- testString: assert(code.match(/\.green\s*?{\s*?background-color:\s*?hsl/gi));
- - text: Your code should use the hsl() property to declare the color cyan.
- testString: assert(code.match(/\.cyan\s*?{\s*?background-color:\s*?hsl/gi));
- - text: Your code should use the hsl() property to declare the color blue.
- testString: assert(code.match(/\.blue\s*?{\s*?background-color:\s*?hsl/gi));
- - text: The div element with class green should have a background-color of green.
- testString: assert($('.green').css('background-color') == 'rgb(0, 255, 0)');
- - text: The div element with class cyan should have a background-color of cyan.
- testString: assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)');
- - text: The div element with class blue should have a background-color of blue.
- testString: assert($('.blue').css('background-color') == 'rgb(0, 0, 255)');
+**Saturation** is the amount of gray in a color. A fully saturated color has no gray in it, and a minimally saturated color is almost completely gray. This is given as a percentage with 100% being fully saturated.
+**Lightness** is the amount of white or black in a color. A percentage is given ranging from 0% (black) to 100% (white), where 50% is the normal color.
+
+Here are a few examples of using `hsl()` with fully-saturated, normal lightness colors:
+
+
Color
HSL
red
hsl(0, 100%, 50%)
yellow
hsl(60, 100%, 50%)
green
hsl(120, 100%, 50%)
cyan
hsl(180, 100%, 50%)
blue
hsl(240, 100%, 50%)
magenta
hsl(300, 100%, 50%)
+
+# --instructions--
+
+Change the `background-color` of each `div` element based on the class names (`green`, `cyan`, or `blue`) using `hsl()`. All three should have full saturation and normal lightness.
+
+# --hints--
+
+Your code should use the `hsl()` property to declare the color green.
+
+```js
+assert(code.match(/\.green\s*?{\s*?background-color:\s*?hsl/gi));
```
-
+Your code should use the `hsl()` property to declare the color cyan.
-## Challenge Seed
-
+```js
+assert(code.match(/\.cyan\s*?{\s*?background-color:\s*?hsl/gi));
+```
-
+Your code should use the `hsl()` property to declare the color blue.
+
+```js
+assert(code.match(/\.blue\s*?{\s*?background-color:\s*?hsl/gi));
+```
+
+The `div` element with class `green` should have a `background-color` of green.
+
+```js
+assert($('.green').css('background-color') == 'rgb(0, 255, 0)');
+```
+
+The `div` element with class `cyan` should have a `background-color` of cyan.
+
+```js
+assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)');
+```
+
+The `div` element with class `blue` should have a `background-color` of blue.
+
+```js
+assert($('.blue').css('background-color') == 'rgb(0, 0, 255)');
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.md
index ee33ddb4ff..f2c34e4f13 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.md
@@ -6,37 +6,39 @@ videoUrl: 'https://scrimba.com/c/cnpWZc9'
forumTopicId: 301042
---
-## Description
-
-In the previous challenge, you changed the animation rates for two similarly animated elements by altering their @keyframes rules. You can achieve the same goal by manipulating the animation-duration of multiple elements.
-In the animation running in the code editor, there are three "stars" in the sky that twinkle at the same rate on a continuous loop. To make them twinkle at different rates, you can set the animation-duration property to different values for each element.
-
+# --description--
-## Instructions
-
-Set the animation-duration of the elements with the classes star-1, star-2, and star-3 to 1s, 0.9s, and 1.1s, respectively.
-
+In the previous challenge, you changed the animation rates for two similarly animated elements by altering their `@keyframes` rules. You can achieve the same goal by manipulating the `animation-duration` of multiple elements.
-## Tests
-
+In the animation running in the code editor, there are three "stars" in the sky that twinkle at the same rate on a continuous loop. To make them twinkle at different rates, you can set the `animation-duration` property to different values for each element.
-```yml
-tests:
- - text: The animation-duration property for the star with class star-1 should remain at 1s.
- testString: assert($('.star-1').css('animation-duration') == '1s');
- - text: The animation-duration property for the star with class star-2 should be 0.9s.
- testString: assert($('.star-2').css('animation-duration') == '0.9s');
- - text: The animation-duration property for the star with class star-3 should be 1.1s.
- testString: assert($('.star-3').css('animation-duration') == '1.1s');
+# --instructions--
+Set the `animation-duration` of the elements with the classes `star-1`, `star-2`, and `star-3` to 1s, 0.9s, and 1.1s, respectively.
+
+# --hints--
+
+The `animation-duration` property for the star with class `star-1` should remain at 1s.
+
+```js
+assert($('.star-1').css('animation-duration') == '1s');
```
-
+The `animation-duration` property for the star with class `star-2` should be 0.9s.
-## Challenge Seed
-
+```js
+assert($('.star-2').css('animation-duration') == '0.9s');
+```
-
+The `animation-duration` property for the star with class `star-3` should be 1.1s.
+
+```js
+assert($('.star-3').css('animation-duration') == '1.1s');
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.md
index 73d3f7e2d2..a7e6a78a5f 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/czVmMtZ'
forumTopicId: 301044
---
-## Description
-
+# --description--
+
CSS treats each HTML element as its own box, which is usually referred to as the CSS Box Model. Block-level items automatically start on a new line (think headings, paragraphs, and divs) while inline items sit within surrounding content (like images or spans). The default layout of elements in this way is called the normal flow of a document, but CSS offers the position property to override it.
-When the position of an element is set to relative, it allows you to specify how CSS should move it relative to its current position in the normal flow of the page. It pairs with the CSS offset properties of left or right, and top or bottom. These say how many pixels, percentages, or ems to move the item away from where it is normally positioned. The following example moves the paragraph 10 pixels away from the bottom:
+
+When the position of an element is set to `relative`, it allows you to specify how CSS should move it *relative* to its current position in the normal flow of the page. It pairs with the CSS offset properties of `left` or `right`, and `top` or `bottom`. These say how many pixels, percentages, or ems to move the item *away* from where it is normally positioned. The following example moves the paragraph 10 pixels away from the bottom:
```css
p {
@@ -18,33 +19,29 @@ p {
}
```
-Changing an element's position to relative does not remove it from the normal flow - other elements around it still behave as if that item were in its default position.
-Note: Positioning gives you a lot of flexibility and power over the visual layout of a page. It's good to remember that no matter the position of elements, the underlying HTML markup should be organized and make sense when read from top to bottom. This is how users with visual impairments (who rely on assistive devices like screen readers) access your content.
-
+Changing an element's position to relative does not remove it from the normal flow - other elements around it still behave as if that item were in its default position. **Note:** Positioning gives you a lot of flexibility and power over the visual layout of a page. It's good to remember that no matter the position of elements, the underlying HTML markup should be organized and make sense when read from top to bottom. This is how users with visual impairments (who rely on assistive devices like screen readers) access your content.
-## Instructions
-
-Change the position of the h2 to relative, and use a CSS offset to move it 15 pixels away from the top of where it sits in the normal flow. Notice there is no impact on the positions of the surrounding h1 and p elements.
-
+# --instructions--
-## Tests
-
+Change the `position` of the `h2` to `relative`, and use a CSS offset to move it 15 pixels away from the `top` of where it sits in the normal flow. Notice there is no impact on the positions of the surrounding h1 and p elements.
-```yml
-tests:
- - text: The h2 element should have a position property set to relative.
- testString: assert($('h2').css('position') == 'relative');
- - text: Your code should use a CSS offset to relatively position the h2 15px away from the top of where it normally sits.
- testString: assert($('h2').css('top') == '15px');
+# --hints--
+The `h2` element should have a `position` property set to `relative`.
+
+```js
+assert($('h2').css('position') == 'relative');
```
-
+Your code should use a CSS offset to relatively position the `h2` 15px away from the `top` of where it normally sits.
-## Challenge Seed
-
+```js
+assert($('h2').css('top') == '15px');
+```
-
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.md
index 568c5f20c4..3e89a2fbb9 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.md
@@ -6,39 +6,45 @@ videoUrl: 'https://scrimba.com/c/cEDWPs6'
forumTopicId: 301048
---
-## Description
-
-By manipulating different selectors and properties, you can make interesting shapes. One of the easier ones to try is a crescent moon shape. For this challenge you need to work with the box-shadow property that sets the shadow of an element, along with the border-radius property that controls the roundness of the element's corners.
+# --description--
+
+By manipulating different selectors and properties, you can make interesting shapes. One of the easier ones to try is a crescent moon shape. For this challenge you need to work with the `box-shadow` property that sets the shadow of an element, along with the `border-radius` property that controls the roundness of the element's corners.
+
You will create a round, transparent object with a crisp shadow that is slightly offset to the side - the shadow is actually going to be the moon shape you see.
-In order to create a round object, the border-radius property should be set to a value of 50%.
-You may recall from an earlier challenge that the box-shadow property takes values for offset-x, offset-y, blur-radius, spread-radius and a color value in that order. The blur-radius and spread-radius values are optional.
-
-## Instructions
-
-Manipulate the square element in the editor to create the moon shape. First, change the background-color to transparent, then set the border-radius property to 50% to make the circular shape. Finally, change the box-shadow property to set the offset-x to 25px, the offset-y to 10px, blur-radius to 0, spread-radius to 0, and color to blue.
-
+In order to create a round object, the `border-radius` property should be set to a value of 50%.
-## Tests
-
+You may recall from an earlier challenge that the `box-shadow` property takes values for `offset-x`, `offset-y`, `blur-radius`, `spread-radius` and a color value in that order. The `blur-radius` and `spread-radius` values are optional.
-```yml
-tests:
- - text: The value of the background-color property should be set to transparent.
- testString: assert(code.match(/background-color:\s*?transparent;/gi));
- - text: The value of the border-radius property should be set to 50%.
- testString: assert(code.match(/border-radius:\s*?50%;/gi));
- - text: The value of the box-shadow property should be set to 25px for offset-x, 10px for offset-y, 0 for blur-radius, 0 for spread-radius, and finally blue for the color.
- testString: assert(code.match(/box-shadow:\s*?25px\s+?10px\s+?0(px)?\s+?0(px)?\s+?blue\s*?;/gi));
+# --instructions--
+Manipulate the square element in the editor to create the moon shape. First, change the `background-color` to transparent, then set the `border-radius` property to 50% to make the circular shape. Finally, change the `box-shadow` property to set the `offset-x` to 25px, the `offset-y` to 10px, `blur-radius` to 0, `spread-radius` to 0, and color to blue.
+
+# --hints--
+
+The value of the `background-color` property should be set to `transparent`.
+
+```js
+assert(code.match(/background-color:\s*?transparent;/gi));
```
-
+The value of the `border-radius` property should be set to `50%`.
-## Challenge Seed
-
+```js
+assert(code.match(/border-radius:\s*?50%;/gi));
+```
-
+The value of the `box-shadow` property should be set to 25px for `offset-x`, 10px for `offset-y`, 0 for `blur-radius`, 0 for `spread-radius`, and finally blue for the color.
+
+```js
+assert(
+ code.match(/box-shadow:\s*?25px\s+?10px\s+?0(px)?\s+?0(px)?\s+?blue\s*?;/gi)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
-
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.md
index 7105013bcb..d834206069 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.md
@@ -6,35 +6,33 @@ videoUrl: 'https://scrimba.com/c/c3bR8t7'
forumTopicId: 301049
---
-## Description
-
-You can use the hr tag to add a horizontal line across the width of its containing element. This can be used to define a change in topic or to visually separate groups of content.
-
+# --description--
-## Instructions
-
-Add an hr tag underneath the h4 which contains the card title.
-Note: In HTML, hr is a self-closing tag, and therefore doesn't need a separate closing tag.
-
+You can use the `hr` tag to add a horizontal line across the width of its containing element. This can be used to define a change in topic or to visually separate groups of content.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should add an hr tag to the markup.
- testString: assert($('hr').length == 1);
- - text: The hr tag should come between the title and the paragraph.
- testString: assert(code.match(/<\/h4>\s*?|\s*?\/>)\s*?
/gi));
+Add an `hr` tag underneath the `h4` which contains the card title.
+**Note:** In HTML, `hr` is a self-closing tag, and therefore doesn't need a separate closing tag.
+
+# --hints--
+
+Your code should add an `hr` tag to the markup.
+
+```js
+assert($('hr').length == 1);
```
-
+The `hr` tag should come between the title and the paragraph.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/h4>\s*?|\s*?\/>)\s*?
/gi));
+```
-
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.md
index 11a018cd92..c99300dec3 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/c7amZfW'
forumTopicId: 301051
---
-## Description
-
-When elements have a specified position, such as fixed or relative, the CSS offset properties right, left, top, and bottom can be used in animation rules to create movement.
-As shown in the example below, you can push the item downwards then upwards by setting the top property of the 50% keyframe to 50px, but having it set to 0px for the first (0%) and the last (100%) keyframe.
+# --description--
+
+When elements have a specified `position`, such as `fixed` or `relative`, the CSS offset properties `right`, `left`, `top`, and `bottom` can be used in animation rules to create movement.
+
+As shown in the example below, you can push the item downwards then upwards by setting the `top` property of the `50%` keyframe to 50px, but having it set to 0px for the first (`0%`) and the last (`100%`) keyframe.
```css
@keyframes rainbow {
@@ -28,33 +29,33 @@ As shown in the example below, you can push the item downwards then upwards by s
}
```
-
+# --instructions--
-## Instructions
-
-Add a horizontal motion to the div animation. Using the left offset property, add to the @keyframes rule so rainbow starts at 0 pixels at 0%, moves to 25 pixels at 50%, and ends at -25 pixels at 100%. Don't replace the top property in the editor - the animation should have both vertical and horizontal motion.
-
+Add a horizontal motion to the `div` animation. Using the `left` offset property, add to the `@keyframes` rule so rainbow starts at 0 pixels at `0%`, moves to 25 pixels at `50%`, and ends at -25 pixels at `100%`. Don't replace the `top` property in the editor - the animation should have both vertical and horizontal motion.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: The @keyframes rule for 0% should use the left offset of 0px.
- testString: assert(code.match(/[^50]0%\s*?{[\s\S]*?left:\s*?0px(;[\s\S]*?|\s*?)}/gi));
- - text: The @keyframes rule for 50% should use the left offset of 25px.
- testString: assert(code.match(/50%\s*?{[\s\S]*?left:\s*?25px(;[\s\S]*?|\s*?)}/gi));
- - text: The @keyframes rule for 100% should use the left offset of -25px.
- testString: assert(code.match(/100%\s*?{[\s\S]*?left:\s*?-25px(;[\s\S]*?|\s*?)}/gi));
+The `@keyframes` rule for `0%` should use the `left` offset of 0px.
+```js
+assert(code.match(/[^50]0%\s*?{[\s\S]*?left:\s*?0px(;[\s\S]*?|\s*?)}/gi));
```
-
+The `@keyframes` rule for `50%` should use the `left` offset of 25px.
-## Challenge Seed
-
+```js
+assert(code.match(/50%\s*?{[\s\S]*?left:\s*?25px(;[\s\S]*?|\s*?)}/gi));
+```
-
+The `@keyframes` rule for `100%` should use the `left` offset of -25px.
+
+```js
+assert(code.match(/100%\s*?{[\s\S]*?left:\s*?-25px(;[\s\S]*?|\s*?)}/gi));
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.md
index 50fea7a19d..ff72291152 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.md
@@ -6,32 +6,29 @@ videoUrl: 'https://scrimba.com/c/cQdwJC8'
forumTopicId: 301052
---
-## Description
-
-One way to add texture and interest to a background and have it stand out more is to add a subtle pattern. The key is balance, as you don't want the background to stand out too much, and take away from the foreground. The background property supports the url() function in order to link to an image of the chosen texture or pattern. The link address is wrapped in quotes inside the parentheses.
-
+# --description--
-## Instructions
-
-Using the url of https://cdn-media-1.freecodecamp.org/imgr/MJAkxbh.png, set the background of the whole page with the body selector.
-
+One way to add texture and interest to a background and have it stand out more is to add a subtle pattern. The key is balance, as you don't want the background to stand out too much, and take away from the foreground. The `background` property supports the `url()` function in order to link to an image of the chosen texture or pattern. The link address is wrapped in quotes inside the parentheses.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your body element should have a background property set to a url() with the given link.
- testString: assert(code.match(/background:\s*?url\(\s*("|'|)https:\/\/cdn-media-1\.freecodecamp\.org\/imgr\/MJAkxbh\.png\1\s*\)/gi));
+Using the url of `https://cdn-media-1.freecodecamp.org/imgr/MJAkxbh.png`, set the `background` of the whole page with the `body` selector.
+# --hints--
+
+Your `body` element should have a `background` property set to a `url()` with the given link.
+
+```js
+assert(
+ code.match(
+ /background:\s*?url\(\s*("|'|)https:\/\/cdn-media-1\.freecodecamp\.org\/imgr\/MJAkxbh\.png\1\s*\)/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.md
index 78513b2a02..6c572b5022 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.md
@@ -6,39 +6,41 @@ videoUrl: 'https://scrimba.com/c/c3b4EAp'
forumTopicId: 301053
---
-## Description
-
+# --description--
+
This section of the curriculum focuses on Applied Visual Design. The first group of challenges build on the given card layout to show a number of core principles.
-Text is often a large part of web content. CSS has several options for how to align it with the text-align property.
-text-align: justify; causes all lines of text except the last line to meet the left and right edges of the line box.
-text-align: center; centers the text
-text-align: right; right-aligns the text
-And text-align: left; (the default) left-aligns the text.
-
-## Instructions
-
-Align the h4 tag's text, which says "Google", to the center. Then justify the paragraph tag which contains information about how Google was founded.
-
+Text is often a large part of web content. CSS has several options for how to align it with the `text-align` property.
-## Tests
-
+`text-align: justify;` causes all lines of text except the last line to meet the left and right edges of the line box.
-```yml
-tests:
- - text: Your code should use the text-align property on the h4 tag to set it to center.
- testString: assert($('h4').css('text-align') == 'center');
- - text: Your code should use the text-align property on the p tag to set it to justify.
- testString: assert($('p').css('text-align') == 'justify');
+`text-align: center;` centers the text
+`text-align: right;` right-aligns the text
+
+And `text-align: left;` (the default) left-aligns the text.
+
+# --instructions--
+
+Align the `h4` tag's text, which says "Google", to the center. Then justify the paragraph tag which contains information about how Google was founded.
+
+# --hints--
+
+Your code should use the text-align property on the `h4` tag to set it to center.
+
+```js
+assert($('h4').css('text-align') == 'center');
```
-
+Your code should use the text-align property on the `p` tag to set it to justify.
-## Challenge Seed
-
+```js
+assert($('p').css('text-align') == 'justify');
+```
-
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.md
index 018998639b..398aaa6ec6 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.md
@@ -6,34 +6,33 @@ videoUrl: 'https://scrimba.com/c/c7aKqu4'
forumTopicId: 301055
---
-## Description
-
-The opacity property in CSS is used to adjust the opacity, or conversely, the transparency for an item.
+# --description--
+
+The `opacity` property in CSS is used to adjust the opacity, or conversely, the transparency for an item.
+
A value of 1 is opaque, which isn't transparent at all. A value of 0.5 is half see-through. A value of 0 is completely transparent.
+
The value given will apply to the entire element, whether that's an image with some transparency, or the foreground and background colors for a block of text.
-
-## Instructions
-
-Set the opacity of the anchor tags to 0.7 using links class to select them.
-
+# --instructions--
-## Tests
-
+Set the `opacity` of the anchor tags to 0.7 using `links` class to select them.
-```yml
-tests:
- - text: Your code should set the opacity property to 0.7 on the anchor tags by selecting the class of links.
- testString: assert(/\.links\s*{([\s\S]*?;)*\s*opacity\s*:\s*0*\.70*\s*(;[\s\S]*?|\s*)}/.test($('style').text()));
+# --hints--
+Your code should set the `opacity` property to 0.7 on the anchor tags by selecting the class of `links`.
+
+```js
+assert(
+ /\.links\s*{([\s\S]*?;)*\s*opacity\s*:\s*0*\.70*\s*(;[\s\S]*?|\s*)}/.test(
+ $('style').text()
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.md
index 441f068dcd..1a29dfb5bc 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.md
@@ -6,37 +6,39 @@ videoUrl: 'https://scrimba.com/c/cyLJ7c3'
forumTopicId: 301060
---
-## Description
-
-The next option for the CSS position property is absolute, which locks the element in place relative to its parent container. Unlike the relative position, this removes the element from the normal flow of the document, so surrounding items ignore it. The CSS offset properties (top or bottom and left or right) are used to adjust the position.
-One nuance with absolute positioning is that it will be locked relative to its closest positioned ancestor. If you forget to add a position rule to the parent item, (this is typically done using position: relative;), the browser will keep looking up the chain and ultimately default to the body tag.
-
+# --description--
-## Instructions
-
-Lock the #searchbar element to the top-right of its section parent by declaring its position as absolute. Give it top and right offsets of 50 pixels each.
-
+The next option for the CSS `position` property is `absolute`, which locks the element in place relative to its parent container. Unlike the `relative` position, this removes the element from the normal flow of the document, so surrounding items ignore it. The CSS offset properties (top or bottom and left or right) are used to adjust the position.
-## Tests
-
+One nuance with absolute positioning is that it will be locked relative to its closest *positioned* ancestor. If you forget to add a position rule to the parent item, (this is typically done using `position: relative;`), the browser will keep looking up the chain and ultimately default to the body tag.
-```yml
-tests:
- - text: The #searchbar element should have a position set to absolute.
- testString: assert($('#searchbar').css('position') == 'absolute');
- - text: Your code should use the top CSS offset of 50 pixels on the #searchbar element.
- testString: assert($('#searchbar').css('top') == '50px');
- - text: Your code should use the right CSS offset of 50 pixels on the #searchbar element.
- testString: assert($('#searchbar').css('right') == '50px');
+# --instructions--
+Lock the `#searchbar` element to the top-right of its `section` parent by declaring its `position` as `absolute`. Give it `top` and `right` offsets of 50 pixels each.
+
+# --hints--
+
+The `#searchbar` element should have a `position` set to `absolute`.
+
+```js
+assert($('#searchbar').css('position') == 'absolute');
```
-
+Your code should use the `top` CSS offset of 50 pixels on the `#searchbar` element.
-## Challenge Seed
-
+```js
+assert($('#searchbar').css('top') == '50px');
+```
-
+Your code should use the `right` CSS offset of 50 pixels on the `#searchbar` element.
+
+```js
+assert($('#searchbar').css('right') == '50px');
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.md
index a3b077bdd6..ef0679833d 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.md
@@ -6,35 +6,33 @@ videoUrl: 'https://scrimba.com/c/c9bQEA4'
forumTopicId: 301065
---
-## Description
-
-The CSS offsets of top or bottom, and left or right tell the browser how far to offset an item relative to where it would sit in the normal flow of the document. You're offsetting an element away from a given spot, which moves the element away from the referenced side (effectively, the opposite direction). As you saw in the last challenge, using the top offset moved the h2 downwards. Likewise, using a left offset moves an item to the right.
-
-
+# --description--
-## Instructions
-
-Use CSS offsets to move the h2 15 pixels to the right and 10 pixels up.
-
+The CSS offsets of `top` or `bottom`, and `left` or `right` tell the browser how far to offset an item relative to where it would sit in the normal flow of the document. You're offsetting an element away from a given spot, which moves the element away from the referenced side (effectively, the opposite direction). As you saw in the last challenge, using the top offset moved the `h2` downwards. Likewise, using a left offset moves an item to the right.
-## Tests
-
+
-```yml
-tests:
- - text: Your code should use a CSS offset to relatively position the h2 10px upwards. In other words, move it 10px away from the bottom of where it normally sits.
- testString: assert($('h2').css('bottom') == '10px');
- - text: Your code should use a CSS offset to relatively position the h2 15px towards the right. In other words, move it 15px away from the left of where it normally sits.
- testString: assert($('h2').css('left') == '15px');
+# --instructions--
+Use CSS offsets to move the `h2` 15 pixels to the right and 10 pixels up.
+
+# --hints--
+
+Your code should use a CSS offset to relatively position the `h2` 10px upwards. In other words, move it 10px away from the `bottom` of where it normally sits.
+
+```js
+assert($('h2').css('bottom') == '10px');
```
-
+Your code should use a CSS offset to relatively position the `h2` 15px towards the right. In other words, move it 15px away from the `left` of where it normally sits.
-## Challenge Seed
-
+```js
+assert($('h2').css('left') == '15px');
+```
-
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.md
index 1b021a5789..6e37fd9c6b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.md
@@ -6,34 +6,31 @@ videoUrl: 'https://scrimba.com/c/c2MDqu2'
forumTopicId: 301066
---
-## Description
-
-The next positioning tool does not actually use position, but sets the float property of an element. Floating elements are removed from the normal flow of a document and pushed to either the left or right of their containing parent element. It's commonly used with the width property to specify how much horizontal space the floated element requires.
-
+# --description--
-## Instructions
-
-The given markup would work well as a two-column layout, with the section and aside elements next to each other. Give the #left item a float of left and the #right item a float of right.
-
+The next positioning tool does not actually use `position`, but sets the `float` property of an element. Floating elements are removed from the normal flow of a document and pushed to either the `left` or `right` of their containing parent element. It's commonly used with the `width` property to specify how much horizontal space the floated element requires.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: The element with id left should have a float value of left.
- testString: assert($('#left').css('float') == 'left');
- - text: The element with id right should have a float value of right.
- testString: assert($('#right').css('float') == 'right');
+The given markup would work well as a two-column layout, with the `section` and `aside` elements next to each other. Give the `#left` item a `float` of `left` and the `#right` item a `float` of `right`.
+# --hints--
+
+The element with id `left` should have a `float` value of `left`.
+
+```js
+assert($('#left').css('float') == 'left');
```
-
+The element with id `right` should have a `float` value of `right`.
-## Challenge Seed
-
+```js
+assert($('#right').css('float') == 'right');
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -107,5 +97,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.md
index db65762b31..605028841c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.md
@@ -6,14 +6,14 @@ videoUrl: 'https://scrimba.com/c/cPpQNT3'
forumTopicId: 301067
---
-## Description
-
-The font-size property is used to specify how large the text is in a given element. This rule can be used for multiple elements to create visual consistency of text on a page. In this challenge, you'll set the values for all h1 through h6 tags to balance the heading sizes.
-
+# --description--
+
+The `font-size` property is used to specify how large the text is in a given element. This rule can be used for multiple elements to create visual consistency of text on a page. In this challenge, you'll set the values for all `h1` through `h6` tags to balance the heading sizes.
+
+# --instructions--
-## Instructions
-
In the style tags, set the font-size of the:
+
h1 tag to 68px.
h2 tag to 52px.
@@ -22,34 +22,49 @@ The font-size property is used to specify how large the text is in
h5 tag to 21px.
h6 tag to 14px.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should set the font-size property for the h1 tag to 68 pixels.
- testString: assert($('h1').css('font-size') == '68px');
- - text: Your code should set the font-size property for the h2 tag to 52 pixels.
- testString: assert($('h2').css('font-size') == '52px');
- - text: Your code should set the font-size property for the h3 tag to 40 pixels.
- testString: assert($('h3').css('font-size') == '40px');
- - text: Your code should set the font-size property for the h4 tag to 32 pixels.
- testString: assert($('h4').css('font-size') == '32px');
- - text: Your code should set the font-size property for the h5 tag to 21 pixels.
- testString: assert($('h5').css('font-size') == '21px');
- - text: Your code should set the font-size property for the h6 tag to 14 pixels.
- testString: const regex = /h6\s*\{\s*font-size\s*:\s*14px\s*(;\s*\}|\})/i; assert.strictEqual(true, regex.test(code));
+Your code should set the `font-size` property for the `h1` tag to 68 pixels.
+```js
+assert($('h1').css('font-size') == '68px');
```
-
+Your code should set the `font-size` property for the `h2` tag to 52 pixels.
-## Challenge Seed
-
+```js
+assert($('h2').css('font-size') == '52px');
+```
-
+Your code should set the `font-size` property for the `h3` tag to 40 pixels.
+
+```js
+assert($('h3').css('font-size') == '40px');
+```
+
+Your code should set the `font-size` property for the `h4` tag to 32 pixels.
+
+```js
+assert($('h4').css('font-size') == '32px');
+```
+
+Your code should set the `font-size` property for the `h5` tag to 21 pixels.
+
+```js
+assert($('h5').css('font-size') == '21px');
+```
+
+Your code should set the `font-size` property for the `h6` tag to 14 pixels.
+
+```js
+const regex = /h6\s*\{\s*font-size\s*:\s*14px\s*(;\s*\}|\})/i;
+assert.strictEqual(true, regex.test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.md
index 64520650c7..21771668f5 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cg4vZAa'
forumTopicId: 301073
---
-## Description
-
-You can use CSS @keyframes to change the color of a button in its hover state.
+# --description--
+
+You can use CSS `@keyframes` to change the color of a button in its hover state.
+
Here's an example of changing the width of an image on hover:
```html
@@ -28,32 +29,29 @@ Here's an example of changing the width of an image on hover:
```
-
+# --instructions--
-## Instructions
-
-Note that ms stands for milliseconds, where 1000ms is equal to 1s.
-Use CSS @keyframes to change the background-color of the button element so it becomes #4791d0 when a user hovers over it. The @keyframes rule should only have an entry for 100%.
-
+Note that `ms` stands for milliseconds, where 1000ms is equal to 1s.
-## Tests
-
+Use CSS `@keyframes` to change the `background-color` of the `button` element so it becomes `#4791d0` when a user hovers over it. The `@keyframes` rule should only have an entry for `100%`.
-```yml
-tests:
- - text: The @keyframes rule should use the animation-name background-color.
- testString: assert(code.match(/@keyframes\s+?background-color\s*?{/g));
- - text: There should be one rule under @keyframes that changes the background-color to #4791d0 at 100%.
- testString: assert(code.match(/100%\s*?{\s*?background-color:\s*?#4791d0;\s*?}/gi));
+# --hints--
+The @keyframes rule should use the `animation-name` background-color.
+
+```js
+assert(code.match(/@keyframes\s+?background-color\s*?{/g));
```
-
+There should be one rule under `@keyframes` that changes the `background-color` to `#4791d0` at 100%.
-## Challenge Seed
-
+```js
+assert(code.match(/100%\s*?{\s*?background-color:\s*?#4791d0;\s*?}/gi));
+```
-
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.md
index ccf6c94bf9..d931ea4c91 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cyLP8Sr'
forumTopicId: 301074
---
-## Description
-
-The next function of the transform property is skewX(), which skews the selected element along its X (horizontal) axis by a given degree.
+# --description--
+
+The next function of the `transform` property is `skewX()`, which skews the selected element along its X (horizontal) axis by a given degree.
+
The following code skews the paragraph element by -32 degrees along the X-axis.
```css
@@ -17,29 +18,21 @@ p {
}
```
-
+# --instructions--
-## Instructions
-
-Skew the element with the id of bottom by 24 degrees along the X-axis by using the transform property.
-
+Skew the element with the id of `bottom` by 24 degrees along the X-axis by using the `transform` property.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: The element with id bottom should be skewed by 24 degrees along its X-axis.
- testString: assert(code.match(/#bottom\s*?{\s*?.*?\s*?transform:\s*?skewX\(24deg\);/g));
+The element with id `bottom` should be skewed by 24 degrees along its X-axis.
+```js
+assert(code.match(/#bottom\s*?{\s*?.*?\s*?transform:\s*?skewX\(24deg\);/g));
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
-
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.md b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.md
index ab48b0778f..638b68eb39 100644
--- a/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.md
+++ b/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.md
@@ -6,34 +6,31 @@ videoUrl: 'https://scrimba.com/c/cVJRBtp'
forumTopicId: 301078
---
-## Description
-
-To emphasize text, you can use the em tag. This displays text as italicized, as the browser applies the CSS of font-style: italic; to the element.
-
+# --description--
-## Instructions
-
-Wrap an em tag around the contents of the paragraph tag to give it emphasis.
-
+To emphasize text, you can use the `em` tag. This displays text as italicized, as the browser applies the CSS of `font-style: italic;` to the element.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should add an em tag to the markup.
- testString: assert($('em').length == 1);
- - text: The em tag should wrap around the contents of the p tag but not the p tag itself.
- testString: assert($('p').children().length == 1 && $('em').children().length == 2);
+Wrap an `em` tag around the contents of the paragraph tag to give it emphasis.
+# --hints--
+
+Your code should add an `em` tag to the markup.
+
+```js
+assert($('em').length == 1);
```
-
+The `em` tag should wrap around the contents of the `p` tag but not the `p` tag itself.
-## Challenge Seed
-
+```js
+assert($('p').children().length == 1 && $('em').children().length == 2);
+```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-013.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-013.md
index bc05783b27..9b2caadeaf 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-013.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-013.md
@@ -4,29 +4,21 @@ title: Part 13
challengeType: 0
---
-## Description
-
+# --description--
In the previous step, you used a type selector to style the `h1` element. Go ahead and center the `h2` and `p` elements with a new type selector for each one.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-014.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-014.md
index 122994ffc6..6c48a2e8bc 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-014.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-014.md
@@ -4,8 +4,7 @@ title: Part 14
challengeType: 0
---
-## Description
-
+# --description--
You now have three type selectors with the exact same styling. You can add the same group of styles to many elements by separating the selectors with commas like this:
@@ -17,24 +16,17 @@ selector1, selector2 {
Use a single type selector to center the `h1`, `h2` and `p` elements at the same time.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-015.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-015.md
index 7143526473..f61d43e1e0 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-015.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-015.md
@@ -4,29 +4,21 @@ title: Part 15
challengeType: 0
---
-## Description
-
+# --description--
-You have styled three elements by writing CSS inside the `style` tags. This works, but since there will many more styles, it's best to put all the styles in a separate file and link to it. Start by rewriting the styles you have created into the `styles.css` file. Make sure to exclude the opening and closing `style` tags.
+You have styled three elements by writing CSS inside the `style` tags. This works, but since there will many more styles, it's best to put all the styles in a separate file and link to it. Start by rewriting the styles you have created into the `styles.css` file. Make sure to exclude the opening and closing `style` tags.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-016.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-016.md
index 44f2fc4cb0..b6a5ed1248 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-016.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-016.md
@@ -4,34 +4,26 @@ title: Part 16
challengeType: 0
---
-## Description
-
+# --description--
Now that you have the CSS in the `styles.css` file, go ahead and remove the `style` element and all its content. Once it is removed, the text that as centered, will shift back to the left.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-017.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-017.md
index cf1713591e..18c2d48117 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-017.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-017.md
@@ -4,39 +4,31 @@ title: Part 17
challengeType: 0
---
-## Description
-
+# --description--
Now you need to link the `styles.css` file so the styles will be applied again. Next a self-closing `link` element in the `head` element. Give it a `rel` attribute value `stylesheet`, a `type` attribute value of `text/css`, and an `href` attribute value of `styles.css`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-018.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-018.md
index 72bc1ce3f2..a6ce32a73f 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-018.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-018.md
@@ -4,8 +4,7 @@ title: Part 18
challengeType: 0
---
-## Description
-
+# --description--
So the styling of the page looks similar on mobile as it does on a desktop or laptop, you need to add a `meta` element with a special `content` attribute.
@@ -15,35 +14,28 @@ Add the following within the `head` element:
```
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-019.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-019.md
index a712976f79..8fd6eb43de 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-019.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-019.md
@@ -4,29 +4,21 @@ title: Part 19
challengeType: 0
---
-## Description
-
+# --description--
The text is centered again so the link to the CSS file is working. Add another style to the file that changes the `background-color` property to `brown` for the `body` element.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
--fcc-editable-region--
h1, h2, p {
@@ -63,6 +51,3 @@ h1, h2, p {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-020.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-020.md
index 6a22cb36c8..2ab85c865e 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-020.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-020.md
@@ -4,29 +4,21 @@ title: Part 20
challengeType: 0
---
-## Description
-
+# --description--
That brown background makes it hard to read the text. Change the `body` element's background color to be `burlywood` so it has some color but you are still be able to read the text.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
--fcc-editable-region--
body {
@@ -66,6 +54,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-021.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-021.md
index cc53428d5e..a6d5bcd965 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-021.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-021.md
@@ -4,29 +4,21 @@ title: Part 21
challengeType: 0
---
-## Description
-
+# --description--
-The `div` element is used mainly for design layout purposes unlike the other content elements you have used so far. Add a `div` element inside the `body` element and then move all the other elements inside the new `div`.
+The `div` element is used mainly for design layout purposes unlike the other content elements you have used so far. Add a `div` element inside the `body` element and then move all the other elements inside the new `div`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-color: burlywood;
@@ -67,6 +55,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-022.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-022.md
index 34aefbd458..0a1fa44894 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-022.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-022.md
@@ -4,29 +4,21 @@ title: Part 22
challengeType: 0
---
-## Description
-
+# --description--
The goal now is to make the `div` not take up the entire width of the page. The CSS `width` property is perfect for this. Create a new type selector in the style sheet that gives your `div` element a width of `300px`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
--fcc-editable-region--
body {
@@ -69,6 +57,3 @@ h1, h2, p {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-023.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-023.md
index b29626e847..6597104065 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-023.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-023.md
@@ -4,8 +4,7 @@ title: Part 23
challengeType: 0
---
-## Description
-
+# --description--
Comments in CSS look like this:
@@ -15,24 +14,17 @@ Comments in CSS look like this:
In your style sheet, comment out the the line containing the `background-color` property and value, so you can see the effect of only styling `div` element. This will make the background white again.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
/*
@@ -75,6 +63,3 @@ div {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-025.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-025.md
index 5f2a33f3ab..4ee0492ac9 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-025.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-025.md
@@ -4,29 +4,21 @@ title: Part 25
challengeType: 0
---
-## Description
-
+# --description--
Now it's easy to see that the text is centered inside the `div` element. Currently, the width of the `div` element is specified in pixels (`px`). Change the `width` property's value to be `80%`, to make it is 80% the width of its parent element (`body`).
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
/*
@@ -75,6 +63,3 @@ div {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-026.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-026.md
index 8ea4ee88c7..d8f665d6ea 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-026.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-026.md
@@ -4,29 +4,21 @@ title: Part 26
challengeType: 0
---
-## Description
-
+# --description--
Next, you want to center the `div` horizontally. You can do this by setting its `margin-left` and `margin-right` properties to `auto`. Think of the margin as invisible space around an element. Using these two margin properties, center the `div` element within the `body` element.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
/*
@@ -76,6 +64,3 @@ div {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-027.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-027.md
index 571c8661ec..faac9b2648 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-027.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-027.md
@@ -4,10 +4,9 @@ title: Part 27
challengeType: 0
---
-## Description
-
+# --description--
-So far you have been using type selectors to style elements. A class selector is defined by a name with a dot directly in front it, like this:
+So far you have been using type selectors to style elements. A class selector is defined by a name with a dot directly in front it, like this:
```css
.class-name {
@@ -17,24 +16,17 @@ So far you have been using type selectors to style elements. A class selec
Change the existing `div` selector into a class selector by replacing `div` with a class named `menu`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
/*
@@ -78,6 +66,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-029.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-029.md
index 413dbc2f8b..a068fe7095 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-029.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-029.md
@@ -4,31 +4,23 @@ title: Part 29
challengeType: 0
---
-## Description
-
+# --description--
Since the cafe's main product for sale is coffee, you could use an image of coffee beans for the background of the page.
Delete the comment and its contents inside the `body` type selector. Now add a `background-image` property and set its value to `url(https://tinyurl.com/coffee-beans-fcc)`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
- --fcc-editable-region--
+--fcc-editable-region--
/*
background-color: burlywood;
*/
- --fcc-editable-region--
+--fcc-editable-region--
}
h1, h2, p {
@@ -80,6 +68,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-030.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-030.md
index 7cedd750dd..152a0a48c2 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-030.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-030.md
@@ -4,29 +4,21 @@ title: Part 30
challengeType: 0
---
-## Description
-
+# --description--
It’s looking good. Time to start adding some menu items. Add an empty `article` element under the `Coffees` heading. It will contain a flavor and price of each coffee you currently offer.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -76,6 +64,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-031.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-031.md
index a8ca036e07..660efede5a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-031.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-031.md
@@ -4,29 +4,21 @@ title: Part 31
challengeType: 0
---
-## Description
-
+# --description--
`article` elements commonly contain multiple elements that have related information. In this case, it will contain a coffee flavor and a price for that flavor. Nest two `p` elements inside your `article` element. The first one's text should be `French Vanilla`, and the second's text `3.00`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -78,6 +66,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-032.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-032.md
index 3e0ab9d895..d1328133e3 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-032.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-032.md
@@ -4,8 +4,7 @@ title: Part 32
challengeType: 0
---
-## Description
-
+# --description--
Starting below the existing coffee/price pair, add the following coffees and prices using an `article` element with two nested `p` elements inside each. As before, the first `p` element's text should contain the coffee flavor and the second `p` element's text should contain the price.
@@ -16,24 +15,17 @@ Hazelnut 4.00
Mocah 4.50
```
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -87,6 +75,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-033.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-033.md
index fe38743152..28cd44ced5 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-033.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-033.md
@@ -4,31 +4,23 @@ title: Part 33
challengeType: 0
---
-## Description
-
+# --description--
The flavors and prices are currently stacked on top of each other and centered with their respectable `p` elements. It would be nice if the flavor was on the left and the price was on the right.
Add the class name `flavor` to the `French Vanilla` `p` element.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -98,6 +86,3 @@ h1, h2, p {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-035.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-035.md
index b5b768d3f0..0c97c02e81 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-035.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-035.md
@@ -4,29 +4,21 @@ title: Part 35
challengeType: 0
---
-## Description
-
+# --description--
Next, you want to align the price to the right. Add a class named `price` to your `p` element that has `3.00` as its text.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -102,6 +90,3 @@ h1, h2, p {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-037.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-037.md
index b570b2ce8a..b965d0d832 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-037.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-037.md
@@ -4,31 +4,23 @@ title: Part 37
challengeType: 0
---
-## Description
-
+# --description--
-That is kind of what you want, but now it would be nice if the flavor and price were on the same line. `p` elements are block-level elements, so they take up the entire width of their parent element.
+That is kind of what you want, but now it would be nice if the flavor and price were on the same line. `p` elements are block-level elements, so they take up the entire width of their parent element.
-To get them on the same line, you need to apply some styling to the `p` elements, so they behave more like `inline` elements. Add a `class` attribute with the value `item` to first `article` element under the `Coffees` heading.
+To get them on the same line, you need to apply some styling to the `p` elements, so they behave more like `inline` elements. Add a `class` attribute with the value `item` to first `article` element under the `Coffees` heading.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-038.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-038.md
index f7563cceef..2d7dcd23e1 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-038.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-038.md
@@ -4,10 +4,9 @@ title: Part 38
challengeType: 0
---
-## Description
-
+# --description--
-The `p` elements are nested in an `article` elements with the class attribute of `item`. You can style all the `p` elements nested anywhere in elements with a class named `item` like this:
+The `p` elements are nested in an `article` elements with the class attribute of `item`. You can style all the `p` elements nested anywhere in elements with a class named `item` like this:
```css
.item p { }
@@ -15,24 +14,17 @@ The `p` elements are nested in an `article` elements with the class attribute of
Using the above selector, add a `display` property with value `inline-block` so the `p` elements behave more like `inline` elements.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-039.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-039.md
index c33eb40e48..5581f3714c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-039.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-039.md
@@ -4,29 +4,21 @@ title: Part 39
challengeType: 0
---
-## Description
-
+# --description--
That's closer, but the price didn't stay over on the right. This is because `inline-block` elements only take up the width of their content. To spread them out, add a `width` property to the `flavor` and `price` class selectors that have a value of `50%` each.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -108,6 +96,3 @@ h1, h2, p {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-040.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-040.md
index 4784c2afba..582ab5b381 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-040.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-040.md
@@ -4,31 +4,23 @@ title: Part 40
challengeType: 0
---
-## Description
-
+# --description--
Well that did not work. Styling the `p` elements as `inline-block` and placing them on a separate lines in the code, creates an extra space to the right of the first `p` element, causing the second one to shift to the next line. One way to fix this is to make each `p`'s width a little less than `50%`.
Change the `width` value to `49%` for each class to see what happens.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -112,6 +100,3 @@ h1, h2, p {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-041.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-041.md
index 88f348e535..cf6824fa44 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-041.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-041.md
@@ -4,31 +4,23 @@ title: Part 41
challengeType: 0
---
-## Description
-
+# --description--
-That worked, but there is still a little space on the right of the price.
+That worked, but there is still a little space on the right of the price.
-You could keep trying various percentages for the widths. Instead, simply move the price `p` element to be on the same line and make sure there is no space between them.
+You could keep trying various percentages for the widths. Instead, simply move the price `p` element to be on the same line and make sure there is no space between them.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -109,6 +97,3 @@ h1, h2, p {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-043.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-043.md
index e48722bef0..1b3af26d3b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-043.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-043.md
@@ -4,29 +4,21 @@ title: Part 43
challengeType: 0
---
-## Description
-
+# --description--
-Now that you know it works, you can change the remaining `article` and `p` elements to match the first set. Start by adding the class `item` to the other `article` elements.
+Now that you know it works, you can change the remaining `article` and `p` elements to match the first set. Start by adding the class `item` to the other `article` elements.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -109,6 +97,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-044.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-044.md
index ebf0533b31..fa78cd738d 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-044.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-044.md
@@ -4,29 +4,21 @@ title: Part 44
challengeType: 0
---
-## Description
-
+# --description--
Next, position the other `p` elements to be on the same line with no space between them.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -105,6 +93,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-046.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-046.md
index 4e3a14f43a..5c8e228a47 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-046.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-046.md
@@ -4,31 +4,23 @@ title: Part 46
challengeType: 0
---
-## Description
-
+# --description--
-If you make the width of the page preview smaller, you will notice at some point, some of the text on the left starts wrapping around to the next line. This is because the width of the `p` elements on the left side can only take up `50%` of the space.
+If you make the width of the page preview smaller, you will notice at some point, some of the text on the left starts wrapping around to the next line. This is because the width of the `p` elements on the left side can only take up `50%` of the space.
Since you know the prices on the right have significantly fewer characters, change the `flavor` class `width` value to be `75%` and then `dessert` class `width` value to be `25%`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -107,6 +95,3 @@ h1, h2, p {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-047.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-047.md
index 146f4ba022..1585259f03 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-047.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-047.md
@@ -4,29 +4,21 @@ title: Part 47
challengeType: 0
---
-## Description
-
+# --description--
You will come back to the styling the menu in a few steps, but for now, go ahead add a second `section` element below the first for displaying the desserts offered by the cafe.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -108,6 +96,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-050.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-050.md
index 57e898bdae..c52b41394e 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-050.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-050.md
@@ -4,29 +4,21 @@ title: Part 50
challengeType: 0
---
-## Description
-
+# --description--
Nest two `p` elements inside your `article` element. The first one's text should be `Donut`, and the second's text `1.50`. Put both of them on the same line making sure there is no space between them.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -110,6 +98,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-051.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-051.md
index b1150f2169..0fcb7046dd 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-051.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-051.md
@@ -4,29 +4,21 @@ title: Part 51
challengeType: 0
---
-## Description
-
+# --description--
For the two `p` elements you just added, add `dessert` as the value of the first `p` element's `class` attribute and the value `price` as the second `p` elements `class` attribute.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -111,6 +99,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-052.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-052.md
index 259aa68cba..92051899f2 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-052.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-052.md
@@ -4,31 +4,23 @@ title: Part 52
challengeType: 0
---
-## Description
-
+# --description--
Something does not look right. You added the correct `class` attribute value to the `p` element with `Donunt` as its text, but you have not defined a selector for it.
Since the `flavor` class selector already has the properties you want, just add the `dessert` class name to it.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -113,6 +101,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-053.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-053.md
index dea095609a..39b215631f 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-053.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-053.md
@@ -4,8 +4,7 @@ title: Part 53
challengeType: 0
---
-## Description
-
+# --description--
Below the dessert you just added, add the rest of the desserts and prices using three more `article` elements, each with two nested `p` elements. Each element should have the correct dessert and price text, and all of them should have the correct classes.
@@ -15,24 +14,17 @@ Cheesecake 3.00
Cinammon Roll 2.50
```
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -117,6 +105,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-054.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-054.md
index 0720085ced..d0cc8cfd3f 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-054.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-054.md
@@ -4,31 +4,23 @@ title: Part 54
challengeType: 0
---
-## Description
-
+# --description--
Something does not look right. You added the correct `class` attribute to the `p` elements with dessert names, but you have not defined a selector for it.
Since the `flavor` class selector already has the properties you want, just add the `dessert` class to it.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -122,6 +110,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-055.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-055.md
index 7630e5ea56..1468d366df 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-055.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-055.md
@@ -4,31 +4,23 @@ title: Part 55
challengeType: 0
---
-## Description
-
+# --description--
You can give your menu some space between the content and the sides with various `padding` properties.
Give the `menu` class a `padding-left` and a `padding-right` with the same value `20px`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -122,6 +110,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-057.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-057.md
index 29e1f0aa5f..1cca83befb 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-057.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-057.md
@@ -4,29 +4,21 @@ title: Part 57
challengeType: 0
---
-## Description
-
+# --description--
Since all 4 sides of the menu have the same internal spacing, go ahead and delete the four properties and use a single `padding` property with the value `20px`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -124,6 +112,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-058.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-058.md
index ac8a8d58ff..48cb8b058b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-058.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-058.md
@@ -4,31 +4,23 @@ title: Part 58
challengeType: 0
---
-## Description
-
+# --description--
The current width of the menu will always take of 80% of the `body` element's width. On a very wide screen, the coffee and dessert appear far apart from their prices.
Add a `max-width` property to the `menu` class with a value of `500px` to prevent it from growing too wide.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -123,6 +111,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-059.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-059.md
index ab41b61c26..b58b28c06c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-059.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-059.md
@@ -4,31 +4,23 @@ title: Part 59
challengeType: 0
---
-## Description
-
+# --description--
You can change the `font-family` of text, to make it look different the the default font of your browser. Each browser has some common fonts available to it.
-Change all the text in your `body`, by adding a `font-family` property with the value `sans-serif`. This is a fairly common font that is very readable.
+Change all the text in your `body`, by adding a `font-family` property with the value `sans-serif`. This is a fairly common font that is very readable.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
--fcc-editable-region--
body {
@@ -124,6 +112,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-060.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-060.md
index 436cf32bdd..bd4594c036 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-060.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-060.md
@@ -4,31 +4,23 @@ title: Part 60
challengeType: 0
---
-## Description
-
+# --description--
It is a bit boring for all the text to have the same `font-family`. You can still have the majority of the text `sans-serif` and make just the `h1` and `h2` elements different using a different selector.
Style both the `h1` and the `h2` elements so that only these elements' text use `Impact` font.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -127,6 +115,3 @@ h1, h2, p {
}
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-061.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-061.md
index 996f1fa327..58af113c0c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-061.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-061.md
@@ -4,31 +4,23 @@ title: Part 61
challengeType: 0
---
-## Description
-
+# --description--
-You can add a fallback value for the font-family by adding another font name separated by a comma. This second font would be used in case the browser does not have the font built-in to it.
+You can add a fallback value for the font-family by adding another font name separated by a comma. This second font would be used in case the browser does not have the font built-in to it.
-Add the fallback font `serif` after the `Impact` font.
+Add the fallback font `serif` after the `Impact` font.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-064.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-064.md
index b5673bf2d3..9292f31199 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-064.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-064.md
@@ -4,31 +4,23 @@ title: Part 64
challengeType: 0
---
-## Description
-
+# --description--
The `h1` and `h2` elements' text are set by default values of the user's browser.
-Add two new type selectors (`h1` and `h2`). Use the `font-size` property for both, but use the value `40px` for the `h1` and `30px` for the `h2`.
+Add two new type selectors (`h1` and `h2`). Use the `font-size` property for both, but use the value `40px` for the `h1` and `30px` for the `h2`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-067.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-067.md
index 2e22f1242b..7b5c554f28 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-067.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-067.md
@@ -4,29 +4,21 @@ title: Part 67
challengeType: 0
---
-## Description
-
+# --description--
Add a second `p` element below the one with the link and give it the text `123 freeCodeCamp Drive`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-068.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-068.md
index 1f0589acec..b9b385398c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-068.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-068.md
@@ -4,31 +4,23 @@ title: Part 68
challengeType: 0
---
-## Description
-
+# --description--
You can use an `hr` element to display a divider between sections of different content.
First, add an `hr` element between the first `header` element and the `main` element.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-069.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-069.md
index 7d060968d2..d2917c6a5a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-069.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-069.md
@@ -4,32 +4,23 @@ title: Part 69
challengeType: 0
---
-## Description
-
+# --description--
The default properties of an `hr` element will make it appear as a thin light grey line. You can change the height of the line by specifying a value for the `height` property.
Change the height the `hr` element to be `3px`.
+# --hints--
-
+Test 1
-## Tests
-
-
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-071.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-071.md
index b66f7de428..f5c8b22f1f 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-071.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-071.md
@@ -4,31 +4,23 @@ title: Part 71
challengeType: 0
---
-## Description
-
+# --description--
-Notice the grey color along the edges of the line. Those edges are known as borders. Each side of an element can have a different color or they can all be the same.
+Notice the grey color along the edges of the line. Those edges are known as borders. Each side of an element can have a different color or they can all be the same.
Make all the edges of the `hr` element the same color as the background of it using the `border-color` property.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-072.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-072.md
index 56f17b6037..3c0bcebd14 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-072.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-072.md
@@ -4,31 +4,23 @@ title: Part 72
challengeType: 0
---
-## Description
-
+# --description--
-Notice how the thickness of the line looks bigger? The default value of a property named `border-width` is `1px` for all edges of `hr` elements. By changing the background to the same color as the background, the total height of the line is `5px` (`3px` plus the top and bottom border width of `1px`).
+Notice how the thickness of the line looks bigger? The default value of a property named `border-width` is `1px` for all edges of `hr` elements. By changing the background to the same color as the background, the total height of the line is `5px` (`3px` plus the top and bottom border width of `1px`).
Change the `height` property of the `hr` to be `2px`, so the total height of it becomes `4px`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-074.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-074.md
index 5ea060ac63..f942d640ef 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-074.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-074.md
@@ -4,29 +4,21 @@ title: Part 74
challengeType: 0
---
-## Description
-
+# --description--
To create a little more room around the menu, add `20px` of space on the inside of the `body` element by using the `padding` property.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-075.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-075.md
index c3d8cf8078..92007c94d8 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-075.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-075.md
@@ -4,31 +4,23 @@ title: Part 75
challengeType: 0
---
-## Description
-
+# --description--
Focusing on the menu items and prices, there is a fairly large gap between each line.
Target all the `p` elements nested in elements with the `class` named `item` and set their top and bottom margin to be `5px`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-076.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-076.md
index 55c018acb2..d8e292bd08 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-076.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-076.md
@@ -4,29 +4,21 @@ title: Part 76
challengeType: 0
---
-## Description
-
+# --description--
Using the same style selector in the previous step, make the font size of the items and prices larger by using a value of `18px`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-077.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-077.md
index f30fa3bb1c..cf0e81ebbc 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-077.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-077.md
@@ -4,31 +4,23 @@ title: Part 77
challengeType: 0
---
-## Description
-
+# --description--
Changing the `bottom-margin` to `5px` looks great. However, now the space between the `Cinnamon Roll` menu item and the second `hr` element does not match the space between the top `hr` element and the `Coffees` heading.
Add some more space by creating a class named `bottom-line` using `25px` for the `margin-top` property.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-079.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-079.md
index bbfab85dd6..9765996fa4 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-079.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-079.md
@@ -4,29 +4,21 @@ title: Part 79
challengeType: 0
---
-## Description
-
+# --description--
-Next you are going to be styling the `footer` element. To keep the CSS organized, add a comment at the end `styles.css` with the text `FOOTER`.
+Next you are going to be styling the `footer` element. To keep the CSS organized, add a comment at the end `styles.css` with the text `FOOTER`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-080.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-080.md
index d40b404160..8174745dde 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-080.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-080.md
@@ -4,29 +4,21 @@ title: Part 80
challengeType: 0
---
-## Description
-
+# --description--
Moving down to the `footer` element, make all the text have a value of `14px` for the font size.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-081.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-081.md
index d2a5e8e7b2..6a02da792b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-081.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-081.md
@@ -4,31 +4,23 @@ title: Part 81
challengeType: 0
---
-## Description
-
+# --description--
-The default color of link that has not yet been clicked on a page is typically blue. The default color of a link that has already been visited from a page is typically purple.
+The default color of link that has not yet been clicked on a page is typically blue. The default color of a link that has already been visited from a page is typically purple.
To make the `footer` links the same color regardless if a link has been visited, use a type selector for the anchor element (`a`) and use the value `black` for the `color` property.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-082.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-082.md
index 2cf08a0a73..0373190a3b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-082.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-082.md
@@ -4,31 +4,23 @@ title: Part 82
challengeType: 0
---
-## Description
-
+# --description--
You change properties of a link when the link has actually been visited by using a pseudo-selector that looks like `a:visited { propertyName: propertyValue; }`.
Change the color of the footer `Visit our website` link to be `grey` when a user has visited the link.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
```css
body {
background-image: url(https://tinyurl.com/coffee-beans-fcc);
@@ -175,6 +163,3 @@ a {
--fcc-editable-region--
```
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-083.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-083.md
index 9bfa99a6fe..3e3d62040f 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-083.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-083.md
@@ -4,31 +4,23 @@ title: Part 83
challengeType: 0
---
-## Description
-
+# --description--
You change properties of a link when the mouse hovers them by using a pseudo-selector that looks like `a:hover { propertyName: propertyValue; }`.
Change the color of the footer `Visit our website` link to be `brown` when a user hovers over it.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-084.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-084.md
index 9523be3c2f..6017dfecf1 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-084.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-084.md
@@ -4,32 +4,23 @@ title: Part 84
challengeType: 0
---
-## Description
-
+# --description--
You change properties of a link when the link is actually clicked by using a pseudo-selector that looks like `a:active { propertyName: propertyValue; }`.
Change the color of the footer `Visit our website` link to be `white` when a clicks on it.
+# --hints--
-
+Test 1
-## Tests
-
-
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-085.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-085.md
index 137e155b58..4f4409c5f7 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-085.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-085.md
@@ -4,29 +4,21 @@ title: Part 85
challengeType: 0
---
-## Description
-
+# --description--
-To keep with the same color theme you have already been using (black and brown), change the color for when the link is visited to `black` and use `brown` for when the link is actually clicked.
+To keep with the same color theme you have already been using (black and brown), change the color for when the link is visited to `black` and use `brown` for when the link is actually clicked.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-086.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-086.md
index 736a8f0d92..0ffd1956b5 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-086.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-086.md
@@ -4,31 +4,23 @@ title: Part 86
challengeType: 0
---
-## Description
-
+# --description--
-The menu text `CAMPER CAFE` has a different space from the top than the address at the bottom of the menu. This is due to the browser having some default top margin for the `h1` element.
+The menu text `CAMPER CAFE` has a different space from the top than the address at the bottom of the menu. This is due to the browser having some default top margin for the `h1` element.
Change the top margin of the `h1` element to `0` to remove all the top margin.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-087.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-087.md
index e41b9de330..b82902a801 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-087.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-087.md
@@ -4,29 +4,21 @@ title: Part 87
challengeType: 0
---
-## Description
-
+# --description--
To remove some of the vertical space between the `h1` element and the text `Est. 2020`, change the bottom margin of the `h1` to `15px`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-088.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-088.md
index 94116d2d45..2d974cdf74 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-088.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-088.md
@@ -4,31 +4,23 @@ title: Part 88
challengeType: 0
---
-## Description
-
+# --description--
Now the top spacing looks good. The space below the address at the bottom of the menu is a little bigger than the space at the top of the menu and the `h1` element.
To decrease the default margin space below the address `p` element, create a class selector named `address` and use the value `5px` for the `margin-bottom` property.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-090.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-090.md
index 2353614abc..62bfffc5bf 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-090.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-090.md
@@ -4,31 +4,23 @@ title: Part 90
challengeType: 0
---
-## Description
-
+# --description--
The menu looks good, but other than the coffee beans background image, it is mainly just text.
Under the `Coffees` heading, add an image using the url `https://tinyurl.com/cafe-coffee-fcc`. Give the image an `alt` value of `coffee icon`.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-091.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-091.md
index 4036f24457..76744355c3 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-091.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-091.md
@@ -4,31 +4,23 @@ title: Part 91
challengeType: 0
---
-## Description
-
+# --description--
-The image you added is not centered horizontally like the `Coffees` heading above it. `img` elements are "like" inline elements.
+The image you added is not centered horizontally like the `Coffees` heading above it. `img` elements are "like" inline elements.
To make the image behave like heading elements (which are block-level), create an `img` type selector and use the value `block` for the `display` property and use the applicable `margin-left` and `margin-right` values to center it horizontally.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-093.md b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-093.md
index b0f85e0fd5..3084d4e1ea 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-093.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-093.md
@@ -4,31 +4,23 @@ title: Part 93
challengeType: 0
---
-## Description
-
+# --description--
It would be nice if the vertical space between the `h2` elements and their associated icons was smaller. The `h2` elements have default top and bottom margin space, so you could change the bottom margin of the `h2` elements to say `0` or another number.
There is an easier way, simply add a negative top margin to the `img` elements to pull them up from their current positions. Negative values are created using a `-` in front of the value. To complete this project, go ahead and use a negative margin of `25px` in the `img` type selector.
-
+# --hints--
-## Tests
-
+Test 1
-```yml
-tests:
- - text: Test 1
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
-
-
+---
```css
body {
@@ -371,5 +354,3 @@ a:active {
color: brown;
}
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.md
index 1124225f0d..b3706e7b13 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.md
@@ -6,34 +6,29 @@ videoUrl: 'https://scrimba.com/c/cnpyGs3'
forumTopicId: 16166
---
-## Description
-
-An element's margin controls the amount of space between an element's border and surrounding elements.
-If you set an element's margin to a negative value, the element will grow larger.
-
+# --description--
-## Instructions
-
-Try to set the margin to a negative value like the one for the red box.
-Change the margin of the blue box to -15px, so it fills the entire horizontal width of the yellow box around it.
-
+An element's `margin` controls the amount of space between an element's `border` and surrounding elements.
-## Tests
-
+If you set an element's `margin` to a negative value, the element will grow larger.
-```yml
-tests:
- - text: Your blue-box class should give elements -15px of margin.
- testString: assert($(".blue-box").css("margin-top") === "-15px");
+# --instructions--
+Try to set the `margin` to a negative value like the one for the red box.
+
+Change the `margin` of the blue box to `-15px`, so it fills the entire horizontal width of the yellow box around it.
+
+# --hints--
+
+Your `blue-box` class should give elements `-15px` of `margin`.
+
+```js
+assert($('.blue-box').css('margin-top') === '-15px');
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
+# --instructions--
-## Instructions
-
-Create a class called thick-green-border. This class should add a 10px, solid, green border around an HTML element. Apply the class to your cat photo.
-Remember that you can apply multiple classes to an element using its class attribute, by separating each class name with a space. For example:
-<img class="class1 class2">
-
+Create a class called `thick-green-border`. This class should add a 10px, solid, green border around an HTML element. Apply the class to your cat photo.
-## Tests
-
+Remember that you can apply multiple classes to an element using its `class` attribute, by separating each class name with a space. For example:
-```yml
-tests:
- - text: Your img element should have the class smaller-image.
- testString: assert($("img").hasClass("smaller-image"));
- - text: Your img element should have the class thick-green-border.
- testString: assert($("img").hasClass("thick-green-border"));
- - text: Your image should have a border width of 10px.
- testString: assert($("img").hasClass("thick-green-border") && parseInt($("img").css("border-top-width"), 10) >= 8 && parseInt($("img").css("border-top-width"), 10) <= 12);
- - text: Your image should have a border style of solid.
- testString: assert($("img").css("border-right-style") === "solid");
- - text: The border around your img element should be green.
- testString: assert($("img").css("border-left-color") === "rgb(0, 128, 0)");
+``
+# --hints--
+
+Your `img` element should have the class `smaller-image`.
+
+```js
+assert($('img').hasClass('smaller-image'));
```
-
+Your `img` element should have the class `thick-green-border`.
-## Challenge Seed
-
+```js
+assert($('img').hasClass('thick-green-border'));
+```
-
+Your image should have a border width of `10px`.
+
+```js
+assert(
+ $('img').hasClass('thick-green-border') &&
+ parseInt($('img').css('border-top-width'), 10) >= 8 &&
+ parseInt($('img').css('border-top-width'), 10) <= 12
+);
+```
+
+Your image should have a border style of `solid`.
+
+```js
+assert($('img').css('border-right-style') === 'solid');
+```
+
+The border around your `img` element should be green.
+
+```js
+assert($('img').css('border-left-color') === 'rgb(0, 128, 0)');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -109,12 +124,7 @@ tests:
```
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -175,5 +185,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.md
index 295b7ec328..2f3f7c2fba 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.md
@@ -6,39 +6,45 @@ videoUrl: 'https://scrimba.com/c/cg4RWh4'
forumTopicId: 16633
---
-## Description
-
-Sometimes you will want to customize an element so that it has a different margin on each of its sides.
-CSS allows you to control the margin of all four individual sides of an element with the margin-top, margin-right, margin-bottom, and margin-left properties.
-
+# --description--
-## Instructions
-
-Give the blue box a margin of 40px on its top and left side, but only 20px on its bottom and right side.
-
+Sometimes you will want to customize an element so that it has a different `margin` on each of its sides.
-## Tests
-
+CSS allows you to control the `margin` of all four individual sides of an element with the `margin-top`, `margin-right`, `margin-bottom`, and `margin-left` properties.
-```yml
-tests:
- - text: Your blue-box class should give the top of elements 40px of margin.
- testString: assert($(".blue-box").css("margin-top") === "40px");
- - text: Your blue-box class should give the right of elements 20px of margin.
- testString: assert($(".blue-box").css("margin-right") === "20px");
- - text: Your blue-box class should give the bottom of elements 20px of margin.
- testString: assert($(".blue-box").css("margin-bottom") === "20px");
- - text: Your blue-box class should give the left of elements 40px of margin.
- testString: assert($(".blue-box").css("margin-left") === "40px");
+# --instructions--
+Give the blue box a `margin` of `40px` on its top and left side, but only `20px` on its bottom and right side.
+
+# --hints--
+
+Your `blue-box` class should give the top of elements `40px` of `margin`.
+
+```js
+assert($('.blue-box').css('margin-top') === '40px');
```
-
+Your `blue-box` class should give the right of elements `20px` of `margin`.
-## Challenge Seed
-
+```js
+assert($('.blue-box').css('margin-right') === '20px');
+```
-
+Your `blue-box` class should give the bottom of elements `20px` of `margin`.
+
+```js
+assert($('.blue-box').css('margin-bottom') === '20px');
+```
+
+Your `blue-box` class should give the left of elements `40px` of `margin`.
+
+```js
+assert($('.blue-box').css('margin-left') === '40px');
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.md
index c95782f7a9..1c3591fa6c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.md
@@ -6,33 +6,29 @@ videoUrl: 'https://scrimba.com/c/cdRwbuW'
forumTopicId: 301085
---
-## Description
-
-When you create your variables in :root they will set the value of that variable for the whole page.
+# --description--
+
+When you create your variables in `:root` they will set the value of that variable for the whole page.
+
You can then over-write these variables by setting them again within a specific element.
-
-## Instructions
-
-Change the value of --penguin-belly to white in the penguin class.
-
+# --instructions--
-## Tests
-
+Change the value of `--penguin-belly` to `white` in the `penguin` class.
-```yml
-tests:
- - text: The penguin class should reassign the --penguin-belly variable to white.
- testString: assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi));
+# --hints--
+The `penguin` class should reassign the `--penguin-belly` variable to `white`.
+
+```js
+assert(
+ code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi)
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-color-of-text.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-color-of-text.md
index 5f17a4ea1b..dab50affcb 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-color-of-text.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-color-of-text.md
@@ -6,41 +6,47 @@ videoUrl: 'https://scrimba.com/c/cRkVmSm'
forumTopicId: 16775
---
-## Description
-
+# --description--
+
Now let's change the color of some of our text.
-We can do this by changing the style of your h2 element.
-The property that is responsible for the color of an element's text is the color style property.
-Here's how you would set your h2 element's text color to blue:
-<h2 style="color: blue;">CatPhotoApp</h2>
-Note that it is a good practice to end inline style declarations with a ; .
-
-## Instructions
-
-Change your h2 element's style so that its text color is red.
-
+We can do this by changing the `style` of your `h2` element.
-## Tests
-
+The property that is responsible for the color of an element's text is the `color` style property.
-```yml
-tests:
- - text: Your h2 element should have a style declaration.
- testString: assert($("h2").attr('style'));
- - text: Your h2 element should have color set to red.
- testString: assert($("h2")[0].style.color === "red");
- - text: Your style declaration should end with a ; .
- testString: assert($("h2").attr('style') && $("h2").attr('style').endsWith(';'));
+Here's how you would set your `h2` element's text color to blue:
+`
CatPhotoApp
`
+
+Note that it is a good practice to end inline `style` declarations with a `;` .
+
+# --instructions--
+
+Change your `h2` element's style so that its text color is red.
+
+# --hints--
+
+Your `h2` element should have a `style` declaration.
+
+```js
+assert($('h2').attr('style'));
```
-
+Your `h2` element should have color set to `red`.
-## Challenge Seed
-
+```js
+assert($('h2')[0].style.color === 'red');
+```
-
+Your `style` declaration should end with a `;` .
+
+```js
+assert($('h2').attr('style') && $('h2').attr('style').endsWith(';'));
+```
+
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
@@ -76,14 +82,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -118,5 +117,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.md
index 13fc22394a..8acbc0987c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/c3bvDc8'
forumTopicId: 16777
---
-## Description
-
-Font size is controlled by the font-size CSS property, like this:
+# --description--
+
+Font size is controlled by the `font-size` CSS property, like this:
```css
h1 {
@@ -16,29 +16,21 @@ h1 {
}
```
-
+# --instructions--
-## Instructions
-
-Inside the same <style> tag that contains your red-text class, create an entry for p elements and set the font-size to 16 pixels (16px).
-
+Inside the same `
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/give-a-background-color-to-a-div-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/give-a-background-color-to-a-div-element.md
index ee5de098c7..2a300102bc 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/give-a-background-color-to-a-div-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/give-a-background-color-to-a-div-element.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cdRKMCk'
forumTopicId: 18190
---
-## Description
-
-You can set an element's background color with the background-color property.
-For example, if you wanted an element's background color to be green, you'd put this within your style element:
+# --description--
+
+You can set an element's background color with the `background-color` property.
+
+For example, if you wanted an element's background color to be `green`, you'd put this within your `style` element:
```css
.green-background {
@@ -17,33 +18,33 @@ For example, if you wanted an element's background color to be green
+# --instructions--
-## Instructions
-
-Create a class called silver-background with the background-color of silver. Assign this class to your div element.
-
+Create a class called `silver-background` with the `background-color` of silver. Assign this class to your `div` element.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Yourdiv element should have the class silver-background.
- testString: assert($("div").hasClass("silver-background"));
- - text: Your div element should have a silver background.
- testString: assert($("div").css("background-color") === "rgb(192, 192, 192)");
- - text: A class named silver-background should be defined within the style element and the value of silver should be assigned to the background-color property.
- testString: assert(code.match(/\.silver-background\s*{\s*background-color:\s*silver;\s*}/));
+Your`div` element should have the class `silver-background`.
+```js
+assert($('div').hasClass('silver-background'));
```
-
+Your `div` element should have a silver background.
-## Challenge Seed
-
+```js
+assert($('div').css('background-color') === 'rgb(192, 192, 192)');
+```
-
+A class named `silver-background` should be defined within the `style` element and the value of `silver` should be assigned to the `background-color` property.
+
+```js
+assert(code.match(/\.silver-background\s*{\s*background-color:\s*silver;\s*}/));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -106,14 +107,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -179,5 +173,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/import-a-google-font.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/import-a-google-font.md
index 109b0d525f..84933e97b0 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/import-a-google-font.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/import-a-google-font.md
@@ -6,45 +6,70 @@ videoUrl: 'https://scrimba.com/c/cM9MRsJ'
forumTopicId: 18200
---
-## Description
-
+# --description--
+
In addition to specifying common fonts that are found on most operating systems, we can also specify non-standard, custom web fonts for use on our website. There are many sources for web fonts on the Internet. For this example we will focus on the Google Fonts library.
-Google Fonts is a free library of web fonts that you can use in your CSS by referencing the font's URL.
+
+[Google Fonts](https://fonts.google.com/) is a free library of web fonts that you can use in your CSS by referencing the font's URL.
+
So, let's go ahead and import and apply a Google font (note that if Google is blocked in your country, you will need to skip this challenge).
-To import a Google Font, you can copy the font's URL from the Google Fonts library and then paste it in your HTML. For this challenge, we'll import the Lobster font. To do this, copy the following code snippet and paste it into the top of your code editor (before the opening style element):
-<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
-Now you can use the Lobster font in your CSS by using Lobster as the FAMILY_NAME as in the following example: font-family: FAMILY_NAME, GENERIC_NAME;.
+
+To import a Google Font, you can copy the font's URL from the Google Fonts library and then paste it in your HTML. For this challenge, we'll import the `Lobster` font. To do this, copy the following code snippet and paste it into the top of your code editor (before the opening `style` element):
+
+``
+
+Now you can use the `Lobster` font in your CSS by using `Lobster` as the FAMILY_NAME as in the following example:
+`font-family: FAMILY_NAME, GENERIC_NAME;`.
+
The GENERIC_NAME is optional, and is a fallback font in case the other specified font is not available. This is covered in the next challenge.
-Family names are case-sensitive and need to be wrapped in quotes if there is a space in the name. For example, you need quotes to use the "Open Sans" font, but not to use the Lobster font.
-
-## Instructions
-
-Import the Lobster font to your web page. Then, use an element selector to set Lobster as the font-family for your h2 element.
-
+Family names are case-sensitive and need to be wrapped in quotes if there is a space in the name. For example, you need quotes to use the `"Open Sans"` font, but not to use the `Lobster` font.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: You should import the Lobster font.
- testString: assert(new RegExp("googleapis", "gi").test(code));
- - text: Your h2 element should use the font Lobster.
- testString: assert($("h2").css("font-family").match(/lobster/i));
- - text: You should only use an h2 element selector to change the font.
- testString: assert(/\s*[^\.]h2\s*\{\s*font-family\:\s*(['"]?)Lobster\1\s*(;\s*\}|\})/gi.test(code));
- - text: Your p element should still use the font monospace.
- testString: assert($("p").css("font-family").match(/monospace/i));
+Import the Lobster font to your web page. Then, use an element selector to set `Lobster` as the `font-family` for your `h2` element.
+# --hints--
+
+You should import the `Lobster` font.
+
+```js
+assert(new RegExp('googleapis', 'gi').test(code));
```
-
+Your `h2` element should use the font `Lobster`.
-## Challenge Seed
-
+```js
+assert(
+ $('h2')
+ .css('font-family')
+ .match(/lobster/i)
+);
+```
-
+You should only use an `h2` element selector to change the font.
+
+```js
+assert(
+ /\s*[^\.]h2\s*\{\s*font-family\:\s*(['"]?)Lobster\1\s*(;\s*\}|\})/gi.test(
+ code
+ )
+);
+```
+
+Your `p` element should still use the font `monospace`.
+
+```js
+assert(
+ $('p')
+ .css('font-family')
+ .match(/monospace/i)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-css-variables.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-css-variables.md
index 7541562a6a..2a1e4bee42 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-css-variables.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-css-variables.md
@@ -6,34 +6,31 @@ videoUrl: 'https://scrimba.com/c/cyLZZhZ'
forumTopicId: 301088
---
-## Description
-
+# --description--
+
When you create a variable, it is available for you to use inside the selector in which you create it. It also is available in any of that selector's descendants. This happens because CSS variables are inherited, just like ordinary properties.
+
To make use of inheritance, CSS variables are often defined in the :root element.
-:root is a pseudo-class selector that matches the root element of the document, usually the html element. By creating your variables in :root, they will be available globally and can be accessed from any other selector in the style sheet.
-
-## Instructions
-
-Define a variable named --penguin-belly in the :root selector and give it the value of pink. You can then see that the variable is inherited and that all the child elements which use it get pink backgrounds.
-
+`:root` is a pseudo-class selector that matches the root element of the document, usually the `html` element. By creating your variables in `:root`, they will be available globally and can be accessed from any other selector in the style sheet.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: The --penguin-belly variable should be declared in the :root and assigned the value pink.
- testString: assert(code.match(/:root\s*?{[\s\S]*--penguin-belly\s*?:\s*?pink\s*?;[\s\S]*}/gi));
+Define a variable named `--penguin-belly` in the `:root` selector and give it the value of `pink`. You can then see that the variable is inherited and that all the child elements which use it get pink backgrounds.
+# --hints--
+
+The `--penguin-belly` variable should be declared in the `:root` and assigned the value `pink`.
+
+```js
+assert(
+ code.match(/:root\s*?{[\s\S]*--penguin-belly\s*?:\s*?pink\s*?;[\s\S]*}/gi)
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.md
index 5291c1eb3b..1b5ca13879 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.md
@@ -6,47 +6,85 @@ videoUrl: 'https://scrimba.com/c/c9bmdtR'
forumTopicId: 18204
---
-## Description
-
-Now we've proven that every HTML page has a body element, and that its body element can also be styled with CSS.
-Remember, you can style your body element just like any other HTML element, and all your other elements will inherit your body element's styles.
-
+# --description--
-## Instructions
-
-First, create a h1 element with the text Hello World
-Then, let's give all elements on your page the color of green by adding color: green; to your body element's style declaration.
-Finally, give your body element the font-family of monospace by adding font-family: monospace; to your body element's style declaration.
-
+Now we've proven that every HTML page has a `body` element, and that its `body` element can also be styled with CSS.
-## Tests
-
+Remember, you can style your `body` element just like any other HTML element, and all your other elements will inherit your `body` element's styles.
-```yml
-tests:
- - text: You should create an h1 element.
- testString: assert(($("h1").length > 0));
- - text: Your h1 element should have the text Hello World.
- testString: assert(($("h1").length > 0 && $("h1").text().match(/hello world/i)));
- - text: Your h1 element should have a closing tag.
- testString: assert(code.match(/<\/h1>/g) && code.match(/
/g).length === code.match(/
body element should have the color property of green.
- testString: assert(($("body").css("color") === "rgb(0, 128, 0)"));
- - text: Your body element should have the font-family property of monospace.
- testString: assert(($("body").css("font-family").match(/monospace/i)));
- - text: Your h1 element should inherit the font monospace from your body element.
- testString: assert(($("h1").length > 0 && $("h1").css("font-family").match(/monospace/i)));
- - text: Your h1 element should inherit the color green from your body element.
- testString: assert(($("h1").length > 0 && $("h1").css("color") === "rgb(0, 128, 0)"));
+# --instructions--
+First, create a `h1` element with the text `Hello World`
+
+Then, let's give all elements on your page the color of `green` by adding `color: green;` to your `body` element's style declaration.
+
+Finally, give your `body` element the font-family of `monospace` by adding `font-family: monospace;` to your `body` element's style declaration.
+
+# --hints--
+
+You should create an `h1` element.
+
+```js
+assert($('h1').length > 0);
```
-
+Your `h1` element should have the text `Hello World`.
-## Challenge Seed
-
+```js
+assert(
+ $('h1').length > 0 &&
+ $('h1')
+ .text()
+ .match(/hello world/i)
+);
+```
-
+Your `h1` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/h1>/g) &&
+ code.match(/
/g).length === code.match(/
0 &&
+ $('h1')
+ .css('font-family')
+ .match(/monospace/i)
+);
+```
+
+Your `h1` element should inherit the color green from your `body` element.
+
+```js
+assert($('h1').length > 0 && $('h1').css('color') === 'rgb(0, 128, 0)');
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
Hello World!
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.md
index c040950467..54d3345ec8 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.md
@@ -6,34 +6,31 @@ videoUrl: 'https://scrimba.com/c/c2MvrcB'
forumTopicId: 18229
---
-## Description
-
-In addition to pixels, you can also specify the border-radius using a percentage.
-
+# --description--
-## Instructions
-
-Give your cat photo a border-radius of 50%.
-
+In addition to pixels, you can also specify the `border-radius` using a percentage.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your image should have a border radius of 50%, making it perfectly circular.
- testString: assert(parseInt($("img").css("border-top-left-radius")) > 48);
- - text: The border-radius value should use a percentage value of 50%.
- testString: assert(code.match(/50%/g));
+Give your cat photo a `border-radius` of `50%`.
+# --hints--
+
+Your image should have a border radius of `50%`, making it perfectly circular.
+
+```js
+assert(parseInt($('img').css('border-top-left-radius')) > 48);
```
-
+The `border-radius` value should use a percentage value of `50%`.
-## Challenge Seed
-
+```js
+assert(code.match(/50%/g));
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -166,5 +156,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.md
index a8fe5ce851..1b6cbfe650 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.md
@@ -6,47 +6,67 @@ videoUrl: 'https://scrimba.com/c/cm24rcp'
forumTopicId: 18249
---
-## Description
-
-Yay! We just proved that inline styles will override all the CSS declarations in your style element.
+# --description--
+
+Yay! We just proved that inline styles will override all the CSS declarations in your `style` element.
+
But wait. There's one last way to override CSS. This is the most powerful method of all. But before we do it, let's talk about why you would ever want to override CSS.
-In many situations, you will use CSS libraries. These may accidentally override your own CSS. So when you absolutely need to be sure that an element has specific CSS, you can use !important
-Let's go all the way back to our pink-text class declaration. Remember that our pink-text class was overridden by subsequent class declarations, id declarations, and inline styles.
-
-## Instructions
-
-Let's add the keyword !important to your pink-text element's color declaration to make 100% sure that your h1 element will be pink.
+In many situations, you will use CSS libraries. These may accidentally override your own CSS. So when you absolutely need to be sure that an element has specific CSS, you can use `!important`
+
+Let's go all the way back to our `pink-text` class declaration. Remember that our `pink-text` class was overridden by subsequent class declarations, id declarations, and inline styles.
+
+# --instructions--
+
+Let's add the keyword `!important` to your pink-text element's color declaration to make 100% sure that your `h1` element will be pink.
+
An example of how to do this is:
-color: red !important;
-
-## Tests
-
+`color: red !important;`
-```yml
-tests:
- - text: Your h1 element should have the class pink-text.
- testString: assert($("h1").hasClass("pink-text"));
- - text: Your h1 element should have the class blue-text.
- testString: assert($("h1").hasClass("blue-text"));
- - text: Your h1 element should have the id of orange-text.
- testString: assert($("h1").attr("id") === "orange-text");
- - text: Your h1 element should have the inline style of color: white.
- testString: assert(code.match(/pink-text class declaration should have the !important keyword to override all other declarations.
- testString: assert(code.match(/\.pink-text\s*?\{[\s\S]*?color:.*pink.*!important\s*;?[^\.]*\}/g));
- - text: Your h1 element should be pink.
- testString: assert($("h1").css("color") === "rgb(255, 192, 203)");
+# --hints--
+Your `h1` element should have the class `pink-text`.
+
+```js
+assert($('h1').hasClass('pink-text'));
```
-
+Your `h1` element should have the class `blue-text`.
-## Challenge Seed
-
+```js
+assert($('h1').hasClass('blue-text'));
+```
-
+Your `h1` element should have the id of `orange-text`.
+
+```js
+assert($('h1').attr('id') === 'orange-text');
+```
+
+Your `h1` element should have the inline style of `color: white`.
+
+```js
+assert(code.match(/
@@ -68,14 +88,7 @@ tests:
Hello World!
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
Hello World!
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.md
index 22c11015ed..89dcf05582 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-by-styling-id-attributes.md
@@ -6,19 +6,23 @@ videoUrl: 'https://scrimba.com/c/cRkpDhB'
forumTopicId: 18251
---
-## Description
-
-We just proved that browsers read CSS from top to bottom in order of their declaration. That means that, in the event of a conflict, the browser will use whichever CSS declaration came last. Notice that if we even had put blue-text before pink-text in our h1 element's classes, it would still look at the declaration order and not the order of their use!
-But we're not done yet. There are other ways that you can override CSS. Do you remember id attributes?
-Let's override your pink-text and blue-text classes, and make your h1 element orange, by giving the h1 element an id and then styling that id.
-
+# --description--
-## Instructions
-
-Give your h1 element the id attribute of orange-text. Remember, id styles look like this:
-<h1 id="orange-text">
-Leave the blue-text and pink-text classes on your h1 element.
-Create a CSS declaration for your orange-text id in your style element. Here's an example of what this looks like:
+We just proved that browsers read CSS from top to bottom in order of their declaration. That means that, in the event of a conflict, the browser will use whichever CSS declaration came last. Notice that if we even had put `blue-text` before `pink-text` in our `h1` element's classes, it would still look at the declaration order and not the order of their use!
+
+But we're not done yet. There are other ways that you can override CSS. Do you remember id attributes?
+
+Let's override your `pink-text` and `blue-text` classes, and make your `h1` element orange, by giving the `h1` element an id and then styling that id.
+
+# --instructions--
+
+Give your `h1` element the `id` attribute of `orange-text`. Remember, id styles look like this:
+
+`
`
+
+Leave the `blue-text` and `pink-text` classes on your `h1` element.
+
+Create a CSS declaration for your `orange-text` id in your `style` element. Here's an example of what this looks like:
```css
#brown-text {
@@ -26,37 +30,55 @@ Create a CSS declaration for your orange-text id in your styl
}
```
-Note: It doesn't matter whether you declare this CSS above or below pink-text class, since id attribute will always take precedence.
-
+**Note:** It doesn't matter whether you declare this CSS above or below pink-text class, since id attribute will always take precedence.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your h1 element should have the class pink-text.
- testString: assert($("h1").hasClass("pink-text"));
- - text: Your h1 element should have the class blue-text.
- testString: assert($("h1").hasClass("blue-text"));
- - text: Your h1 element should have the id of orange-text.
- testString: assert($("h1").attr("id") === "orange-text");
- - text: There should be only one h1 element.
- testString: assert(($("h1").length === 1));
- - text: Your orange-text id should have a CSS declaration.
- testString: assert(code.match(/#orange-text\s*{/gi));
- - text: Your h1 should not have any style attributes.
- testString: assert(!code.match(//gi));
- - text: Your h1 element should be orange.
- testString: assert($("h1").css("color") === "rgb(255, 165, 0)");
+Your `h1` element should have the class `pink-text`.
+```js
+assert($('h1').hasClass('pink-text'));
```
-
+Your `h1` element should have the class `blue-text`.
-## Challenge Seed
-
+```js
+assert($('h1').hasClass('blue-text'));
+```
-
+Your `h1` element should have the id of `orange-text`.
+
+```js
+assert($('h1').attr('id') === 'orange-text');
+```
+
+There should be only one `h1` element.
+
+```js
+assert($('h1').length === 1);
+```
+
+Your `orange-text` id should have a CSS declaration.
+
+```js
+assert(code.match(/#orange-text\s*{/gi));
+```
+
+Your `h1` should not have any `style` attributes.
+
+```js
+assert(!code.match(//gi));
+```
+
+Your `h1` element should be orange.
+
+```js
+assert($('h1').css('color') === 'rgb(255, 165, 0)');
+```
+
+# --seed--
+
+## --seed-contents--
```html
Hello World!
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.md
index 905791fede..8e7a9d5765 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/override-class-declarations-with-inline-styles.md
@@ -6,43 +6,55 @@ videoUrl: 'https://scrimba.com/c/cGJDRha'
forumTopicId: 18252
---
-## Description
-
-So we've proven that id declarations override class declarations, regardless of where they are declared in your style element CSS.
+# --description--
+
+So we've proven that id declarations override class declarations, regardless of where they are declared in your `style` element CSS.
+
There are other ways that you can override CSS. Do you remember inline styles?
-
-## Instructions
-
-Use an inline style to try to make our h1 element white. Remember, in line styles look like this:
-<h1 style="color: green;">
-Leave the blue-text and pink-text classes on your h1 element.
-
+# --instructions--
-## Tests
-
+Use an inline style to try to make our `h1` element white. Remember, in line styles look like this:
-```yml
-tests:
- - text: Your h1 element should have the class pink-text.
- testString: assert($("h1").hasClass("pink-text"));
- - text: Your h1 element should have the class blue-text.
- testString: assert($("h1").hasClass("blue-text"));
- - text: Your h1 element should have the id of orange-text.
- testString: assert($("h1").attr("id") === "orange-text");
- - text: Your h1 element should have an inline style.
- testString: assert(document.querySelector('h1[style]'));
- - text: Your h1 element should be white.
- testString: assert($("h1").css("color") === "rgb(255, 255, 255)");
+`
`
+Leave the `blue-text` and `pink-text` classes on your `h1` element.
+
+# --hints--
+
+Your `h1` element should have the class `pink-text`.
+
+```js
+assert($('h1').hasClass('pink-text'));
```
-
+Your `h1` element should have the class `blue-text`.
-## Challenge Seed
-
+```js
+assert($('h1').hasClass('blue-text'));
+```
-
+Your `h1` element should have the id of `orange-text`.
+
+```js
+assert($('h1').attr('id') === 'orange-text');
+```
+
+Your `h1` element should have an inline style.
+
+```js
+assert(document.querySelector('h1[style]'));
+```
+
+Your `h1` element should be white.
+
+```js
+assert($('h1').css('color') === 'rgb(255, 255, 255)');
+```
+
+# --seed--
+
+## --seed-contents--
```html
Hello World!
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.md
index 9700add398..4069fe27c8 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/override-styles-in-subsequent-css.md
@@ -6,44 +6,55 @@ videoUrl: 'https://scrimba.com/c/cGJDQug'
forumTopicId: 18253
---
-## Description
-
-Our "pink-text" class overrode our body element's CSS declaration!
-We just proved that our classes will override the body element's CSS. So the next logical question is, what can we do to override our pink-text class?
-
+# --description--
+
+Our "pink-text" class overrode our `body` element's CSS declaration!
+
+We just proved that our classes will override the `body` element's CSS. So the next logical question is, what can we do to override our `pink-text` class?
+
+# --instructions--
+
+Create an additional CSS class called `blue-text` that gives an element the color blue. Make sure it's below your `pink-text` class declaration.
+
+Apply the `blue-text` class to your `h1` element in addition to your `pink-text` class, and let's see which one wins.
-## Instructions
-
-Create an additional CSS class called blue-text that gives an element the color blue. Make sure it's below your pink-text class declaration.
-Apply the blue-text class to your h1 element in addition to your pink-text class, and let's see which one wins.
Applying multiple class attributes to a HTML element is done with a space between them like this:
-class="class1 class2"
-Note: It doesn't matter which order the classes are listed in the HTML element.
-However, the order of the class declarations in the <style> section is what is important. The second declaration will always take precedence over the first. Because .blue-text is declared second, it overrides the attributes of .pink-text
-
-## Tests
-
+`class="class1 class2"`
-```yml
-tests:
- - text: Your h1 element should have the class pink-text.
- testString: assert($("h1").hasClass("pink-text"));
- - text: Your h1 element should have the class blue-text.
- testString: assert($("h1").hasClass("blue-text"));
- - text: Both blue-text and pink-text should belong to the same h1 element.
- testString: assert($(".pink-text").hasClass("blue-text"));
- - text: Your h1 element should be blue.
- testString: assert($("h1").css("color") === "rgb(0, 0, 255)");
+**Note:** It doesn't matter which order the classes are listed in the HTML element.
+However, the order of the `class` declarations in the `
Hello World!
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/prioritize-one-style-over-another.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/prioritize-one-style-over-another.md
index 986064f1ac..c0ca9e1a48 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/prioritize-one-style-over-another.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/prioritize-one-style-over-another.md
@@ -6,39 +6,43 @@ videoUrl: 'https://scrimba.com/c/cZ8wnHv'
forumTopicId: 18258
---
-## Description
-
+# --description--
+
Sometimes your HTML elements will receive multiple styles that conflict with one another.
-For example, your h1 element can't be both green and pink at the same time.
-Let's see what happens when we create a class that makes text pink, then apply it to an element. Will our class override the body element's color: green; CSS property?
-
-## Instructions
-
-Create a CSS class called pink-text that gives an element the color pink.
-Give your h1 element the class of pink-text.
-
+For example, your `h1` element can't be both green and pink at the same time.
-## Tests
-
+Let's see what happens when we create a class that makes text pink, then apply it to an element. Will our class *override* the `body` element's `color: green;` CSS property?
-```yml
-tests:
- - text: Your h1 element should have the class pink-text.
- testString: assert($("h1").hasClass("pink-text"));
- - text: Your <style> should have a pink-text CSS class that changes the color.
- testString: assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g));
- - text: Your h1 element should be pink.
- testString: assert($("h1").css("color") === "rgb(255, 192, 203)");
+# --instructions--
+Create a CSS class called `pink-text` that gives an element the color pink.
+
+Give your `h1` element the class of `pink-text`.
+
+# --hints--
+
+Your `h1` element should have the class `pink-text`.
+
+```js
+assert($('h1').hasClass('pink-text'));
```
-
+Your `
Hello World!
-
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.md
index cb15185f65..76e63a7c4f 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/set-the-font-family-of-an-element.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/c3bvpCg'
forumTopicId: 18278
---
-## Description
-
-You can set which font an element should use, by using the font-family property.
-For example, if you wanted to set your h2 element's font to sans-serif, you would use the following CSS:
+# --description--
+
+You can set which font an element should use, by using the `font-family` property.
+
+For example, if you wanted to set your `h2` element's font to `sans-serif`, you would use the following CSS:
```css
h2 {
@@ -17,29 +18,26 @@ h2 {
}
```
-
+# --instructions--
-## Instructions
-
-Make all of your p elements use the monospace font.
-
+Make all of your `p` elements use the `monospace` font.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your p elements should use the font monospace.
- testString: assert($("p").not(".red-text").css("font-family").match(/monospace/i));
+Your `p` elements should use the font `monospace`.
+```js
+assert(
+ $('p')
+ .not('.red-text')
+ .css('font-family')
+ .match(/monospace/i)
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
+# --instructions--
-## Instructions
-
-Create a class called smaller-image and use it to resize the image so that it's only 100 pixels wide.
-
+Create a class called `smaller-image` and use it to resize the image so that it's only 100 pixels wide.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your img element should have the class smaller-image.
- testString: assert($("img[src='https://bit.ly/fcc-relaxing-cat']").attr('class') === "smaller-image");
- - text: Your image should be 100 pixels wide.
- testString: assert($("img").width() < 200 && code.match(/\.smaller-image\s*{\s*width\s*:\s*100px\s*(;\s*}|})/i));
+Your `img` element should have the class `smaller-image`.
+```js
+assert(
+ $("img[src='https://bit.ly/fcc-relaxing-cat']").attr('class') ===
+ 'smaller-image'
+);
```
-
+Your image should be 100 pixels wide.
-## Challenge Seed
-
+```js
+assert(
+ $('img').width() < 200 &&
+ code.match(/\.smaller-image\s*{\s*width\s*:\s*100px\s*(;\s*}|})/i)
+);
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -157,5 +153,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.md
index f6f97fd483..00c501c3f7 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.md
@@ -6,11 +6,13 @@ videoUrl: 'https://scrimba.com/c/cpVKBfQ'
forumTopicId: 18304
---
-## Description
-
-There are several default fonts that are available in all browsers. These generic font families include monospace, serif and sans-serif
+# --description--
+
+There are several default fonts that are available in all browsers. These generic font families include `monospace`, `serif` and `sans-serif`
+
When one font isn't available, you can tell the browser to "degrade" to another font.
-For example, if you wanted an element to use the Helvetica font, but degrade to the sans-serif font when Helvetica isn't available, you will specify it as follows:
+
+For example, if you wanted an element to use the `Helvetica` font, but degrade to the `sans-serif` font when `Helvetica` isn't available, you will specify it as follows:
```css
p {
@@ -19,37 +21,52 @@ p {
```
Generic font family names are not case-sensitive. Also, they do not need quotes because they are CSS keywords.
-
-## Instructions
-
-To begin, apply the monospace font to the h2 element, so that it now has two fonts - Lobster and monospace.
-In the last challenge, you imported the Lobster font using the link tag. Now comment out that import of the Lobster font (using the HTML comments you learned before) from Google Fonts so that it isn't available anymore. Notice how your h2 element degrades to the monospace font.
-Note: If you have the Lobster font installed on your computer, you won't see the degradation because your browser is able to find the font.
-
+# --instructions--
-## Tests
-
+To begin, apply the `monospace` font to the `h2` element, so that it now has two fonts - `Lobster` and `monospace`.
-```yml
-tests:
- - text: Your h2 element should use the font Lobster.
- testString: assert($("h2").css("font-family").match(/^"?lobster/i));
- - text: Your h2 element should degrade to the font monospace when Lobster is not available.
- testString: assert(/\s*h2\s*\{\s*font-family\:\s*(\'|")?Lobster(\'|")?,\s*monospace\s*;\s*\}/gi.test(code));
- - text: You should comment out your call to Google for the Lobster font by putting <!-- in front of it.
- testString: assert(new RegExp("", "gi").test(code));
+In the last challenge, you imported the `Lobster` font using the `link` tag. Now comment out that import of the `Lobster` font (using the HTML comments you learned before) from Google Fonts so that it isn't available anymore. Notice how your `h2` element degrades to the `monospace` font.
+**Note:** If you have the Lobster font installed on your computer, you won't see the degradation because your browser is able to find the font.
+
+# --hints--
+
+Your h2 element should use the font `Lobster`.
+
+```js
+assert(
+ $('h2')
+ .css('font-family')
+ .match(/^"?lobster/i)
+);
```
-
+Your h2 element should degrade to the font `monospace` when `Lobster` is not available.
-## Challenge Seed
-
+```js
+assert(
+ /\s*h2\s*\{\s*font-family\:\s*(\'|")?Lobster(\'|")?,\s*monospace\s*;\s*\}/gi.test(
+ code
+ )
+);
+```
-
+You should comment out your call to Google for the `Lobster` font by putting ``.
+
+```js
+assert(new RegExp('[^fc]-->', 'gi').test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -101,14 +118,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -159,5 +169,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.md
index 5e02acd619..89a5066343 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/style-multiple-elements-with-a-css-class.md
@@ -6,40 +6,48 @@ videoUrl: 'https://scrimba.com/c/cRkVbsQ'
forumTopicId: 18311
---
-## Description
-
-Classes allow you to use the same CSS styles on multiple HTML elements. You can see this by applying your red-text class to the first p element.
-
+# --description--
-## Instructions
-
+Classes allow you to use the same CSS styles on multiple HTML elements. You can see this by applying your `red-text` class to the first `p` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your h2 element should be red.
- testString: assert($("h2").css("color") === "rgb(255, 0, 0)");
- - text: Your h2 element should have the class red-text.
- testString: assert($("h2").hasClass("red-text"));
- - text: Your first p element should be red.
- testString: assert($("p:eq(0)").css("color") === "rgb(255, 0, 0)");
- - text: Your second and third p elements should not be red.
- testString: assert(!($("p:eq(1)").css("color") === "rgb(255, 0, 0)") && !($("p:eq(2)").css("color") === "rgb(255, 0, 0)"));
- - text: Your first p element should have the class red-text.
- testString: assert($("p:eq(0)").hasClass("red-text"));
+Your `h2` element should be red.
+```js
+assert($('h2').css('color') === 'rgb(255, 0, 0)');
```
-
+Your `h2` element should have the class `red-text`.
-## Challenge Seed
-
+```js
+assert($('h2').hasClass('red-text'));
+```
-
+Your first `p` element should be red.
+
+```js
+assert($('p:eq(0)').css('color') === 'rgb(255, 0, 0)');
+```
+
+Your second and third `p` elements should not be red.
+
+```js
+assert(
+ !($('p:eq(1)').css('color') === 'rgb(255, 0, 0)') &&
+ !($('p:eq(2)').css('color') === 'rgb(255, 0, 0)')
+);
+```
+
+Your first `p` element should have the class `red-text`.
+
+```js
+assert($('p:eq(0)').hasClass('red-text'));
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.md
index aba3b24d0e..c32b19ac21 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/understand-absolute-versus-relative-units.md
@@ -6,37 +6,42 @@ videoUrl: 'https://scrimba.com/c/cN66JSL'
forumTopicId: 301089
---
-## Description
-
-The last several challenges all set an element's margin or padding with pixels (px). Pixels are a type of length unit, which is what tells the browser how to size or space an item. In addition to px, CSS has a number of different length unit options that you can use.
-The two main types of length units are absolute and relative. Absolute units tie to physical units of length. For example, in and mm refer to inches and millimeters, respectively. Absolute length units approximate the actual measurement on a screen, but there are some differences depending on a screen's resolution.
-Relative units, such as em or rem, are relative to another length value. For example, em is based on the size of an element's font. If you use it to set the font-size property itself, it's relative to the parent's font-size.
-Note: There are several relative unit options that are tied to the size of the viewport. They are covered in the Responsive Web Design Principles section.
-
+# --description--
-## Instructions
-
-Add a padding property to the element with class red-box and set it to 1.5em.
-
+The last several challenges all set an element's margin or padding with pixels (`px`). Pixels are a type of length unit, which is what tells the browser how to size or space an item. In addition to `px`, CSS has a number of different length unit options that you can use.
-## Tests
-
+The two main types of length units are absolute and relative. Absolute units tie to physical units of length. For example, `in` and `mm` refer to inches and millimeters, respectively. Absolute length units approximate the actual measurement on a screen, but there are some differences depending on a screen's resolution.
-```yml
-tests:
- - text: Your red-box class should have a padding property.
- testString: assert($('.red-box').css('padding-top') != '0px' && $('.red-box').css('padding-right') != '0px' && $('.red-box').css('padding-bottom') != '0px' && $('.red-box').css('padding-left') != '0px');
- - text: Your red-box class should give elements 1.5em of padding.
- testString: assert(code.match(/\.red-box\s*?{[\s\S]*padding:\s*?1\.5em/gi));
+Relative units, such as `em` or `rem`, are relative to another length value. For example, `em` is based on the size of an element's font. If you use it to set the `font-size` property itself, it's relative to the parent's `font-size`.
+**Note:** There are several relative unit options that are tied to the size of the viewport. They are covered in the Responsive Web Design Principles section.
+
+# --instructions--
+
+Add a `padding` property to the element with class `red-box` and set it to `1.5em`.
+
+# --hints--
+
+Your `red-box` class should have a `padding` property.
+
+```js
+assert(
+ $('.red-box').css('padding-top') != '0px' &&
+ $('.red-box').css('padding-right') != '0px' &&
+ $('.red-box').css('padding-bottom') != '0px' &&
+ $('.red-box').css('padding-left') != '0px'
+);
```
-
+Your `red-box` class should give elements 1.5em of `padding`.
-## Challenge Seed
-
+```js
+assert(code.match(/\.red-box\s*?{[\s\S]*padding:\s*?1\.5em/gi));
+```
-
+# --seed--
+
+## --seed-contents--
```html
```
-You can see that we've created a CSS class called blue-text within the <style> tag.
-You can apply a class to an HTML element like this:
-<h2 class="blue-text">CatPhotoApp</h2>
-Note that in your CSS style element, class names start with a period. In your HTML elements' class attribute, the class name does not include the period.
-
+You can see that we've created a CSS class called `blue-text` within the `
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.md
index 10e33c2e98..3da2cb233a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-a-media-query-to-change-a-variable.md
@@ -6,35 +6,41 @@ videoUrl: 'https://scrimba.com/c/cWmL8UP'
forumTopicId: 301091
---
-## Description
-
+# --description--
+
CSS Variables can simplify the way you use media queries.
+
For instance, when your screen is smaller or larger than your media query break point, you can change the value of a variable, and it will apply its style wherever it is used.
-
-## Instructions
-
-In the :root selector of the media query, change it so --penguin-size is redefined and given a value of 200px. Also, redefine --penguin-skin and give it a value of black. Then resize the preview to see this change in action.
-
+# --instructions--
-## Tests
-
+In the `:root` selector of the `media query`, change it so `--penguin-size` is redefined and given a value of `200px`. Also, redefine `--penguin-skin` and give it a value of `black`. Then resize the preview to see this change in action.
-```yml
-tests:
- - text: :root should reassign the --penguin-size variable to 200px.
- testString: assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-size\s*?:\s*?200px\s*?;[\s\S]*}[\s\S]*}/gi));
- - text: :root should reassign the --penguin-skin variable to black.
- testString: assert(code.match(/media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-skin\s*?:\s*?black\s*?;[\s\S]*}[\s\S]*}/gi));
+# --hints--
+`:root` should reassign the `--penguin-size` variable to `200px`.
+
+```js
+assert(
+ code.match(
+ /media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-size\s*?:\s*?200px\s*?;[\s\S]*}[\s\S]*}/gi
+ )
+);
```
-
+`:root` should reassign the `--penguin-skin` variable to `black`.
-## Challenge Seed
-
+```js
+assert(
+ code.match(
+ /media\s*?\(\s*?max-width\s*?:\s*?350px\s*?\)\s*?{[\s\S]*:root\s*?{[\s\S]*--penguin-skin\s*?:\s*?black\s*?;[\s\S]*}[\s\S]*}/gi
+ )
+);
+```
-
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-abbreviated-hex-code.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-abbreviated-hex-code.md
index c1f3838490..ebafe8770e 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-abbreviated-hex-code.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-abbreviated-hex-code.md
@@ -6,49 +6,73 @@ videoUrl: 'https://scrimba.com/c/cRkpKAm'
forumTopicId: 18338
---
-## Description
-
+# --description--
+
Many people feel overwhelmed by the possibilities of more than 16 million colors. And it's difficult to remember hex code. Fortunately, you can shorten it.
-For example, red's hex code #FF0000 can be shortened to #F00. This shortened form gives one digit for red, one digit for green, and one digit for blue.
-This reduces the total number of possible colors to around 4,000. But browsers will interpret #FF0000 and #F00 as exactly the same color.
-
-## Instructions
-
+For example, red's hex code `#FF0000` can be shortened to `#F00`. This shortened form gives one digit for red, one digit for green, and one digit for blue.
+
+This reduces the total number of possible colors to around 4,000. But browsers will interpret `#FF0000` and `#F00` as exactly the same color.
+
+# --instructions--
+
Go ahead, try using the abbreviated hex codes to color the correct elements.
-
Color
Short Hex Code
Cyan
#0FF
Green
#0F0
Red
#F00
Fuchsia
#F0F
-
-## Tests
-
+
Color
Short Hex Code
Cyan
#0FF
Green
#0F0
Red
#F00
Fuchsia
#F0F
-```yml
-tests:
- - text: Your h1 element with the text I am red! should be given the color red.
- testString: assert($('.red-text').css('color') === 'rgb(255, 0, 0)');
- - text: The abbreviated hex code for the color red should be used instead of the hex code #FF0000.
- testString: assert(code.match(/\.red-text\s*?{\s*?color:\s*?#F00\s*?;\s*?}/gi));
- - text: Your h1 element with the text I am green! should be given the color green.
- testString: assert($('.green-text').css('color') === 'rgb(0, 255, 0)');
- - text: The abbreviated hex code for the color green should be used instead of the hex code #00FF00.
- testString: assert(code.match(/\.green-text\s*?{\s*?color:\s*?#0F0\s*?;\s*?}/gi));
- - text: Your h1 element with the text I am cyan! should be given the color cyan.
- testString: assert($('.cyan-text').css('color') === 'rgb(0, 255, 255)');
- - text: The abbreviated hex code for the color cyan should be used instead of the hex code #00FFFF.
- testString: assert(code.match(/\.cyan-text\s*?{\s*?color:\s*?#0FF\s*?;\s*?}/gi));
- - text: Your h1 element with the text I am fuchsia! should be given the color fuchsia.
- testString: assert($('.fuchsia-text').css('color') === 'rgb(255, 0, 255)');
- - text: The abbreviated hex code for the color fuchsia should be used instead of the hex code #FF00FF.
- testString: assert(code.match(/\.fuchsia-text\s*?{\s*?color:\s*?#F0F\s*?;\s*?}/gi));
+# --hints--
+Your `h1` element with the text `I am red!` should be given the `color` red.
+
+```js
+assert($('.red-text').css('color') === 'rgb(255, 0, 0)');
```
-
+The abbreviated `hex code` for the color red should be used instead of the hex code `#FF0000`.
-## Challenge Seed
-
+```js
+assert(code.match(/\.red-text\s*?{\s*?color:\s*?#F00\s*?;\s*?}/gi));
+```
-
+Your `h1` element with the text `I am green!` should be given the `color` green.
+
+```js
+assert($('.green-text').css('color') === 'rgb(0, 255, 0)');
+```
+
+The abbreviated `hex code` for the color green should be used instead of the hex code `#00FF00`.
+
+```js
+assert(code.match(/\.green-text\s*?{\s*?color:\s*?#0F0\s*?;\s*?}/gi));
+```
+
+Your `h1` element with the text `I am cyan!` should be given the `color` cyan.
+
+```js
+assert($('.cyan-text').css('color') === 'rgb(0, 255, 255)');
+```
+
+The abbreviated `hex code` for the color cyan should be used instead of the hex code `#00FFFF`.
+
+```js
+assert(code.match(/\.cyan-text\s*?{\s*?color:\s*?#0FF\s*?;\s*?}/gi));
+```
+
+Your `h1` element with the text `I am fuchsia!` should be given the `color` fuchsia.
+
+```js
+assert($('.fuchsia-text').css('color') === 'rgb(255, 0, 255)');
+```
+
+The abbreviated `hex code` for the color fuchsia should be used instead of the hex code `#FF00FF`.
+
+```js
+assert(code.match(/\.fuchsia-text\s*?{\s*?color:\s*?#F0F\s*?;\s*?}/gi));
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-Inside that style block, you can create a CSS selector for all h2 elements. For example, if you wanted all h2 elements to be red, you would add a style rule that looks like this:
+Inside that style block, you can create a CSS selector for all `h2` elements. For example, if you wanted all `h2` elements to be red, you would add a style rule that looks like this:
```html
```
-Note that it's important to have both opening and closing curly braces ({ and }) around each element's style rule(s). You also need to make sure that your element's style definition is between the opening and closing style tags. Finally, be sure to add a semicolon to the end of each of your element's style rules.
-
+Note that it's important to have both opening and closing curly braces (`{` and `}`) around each element's style rule(s). You also need to make sure that your element's style definition is between the opening and closing style tags. Finally, be sure to add a semicolon to the end of each of your element's style rules.
-## Instructions
-
-Delete your h2 element's style attribute, and instead create a CSS style block. Add the necessary CSS to turn all h2 elements blue.
-
+# --instructions--
-## Tests
-
+Delete your `h2` element's style attribute, and instead create a CSS `style` block. Add the necessary CSS to turn all `h2` elements blue.
-```yml
-tests:
- - text: The style attribute should be removed from your h2 element.
- testString: assert(!$("h2").attr("style"));
- - text: You should create a style element.
- testString: assert($("style") && $("style").length >= 1);
- - text: Your h2 element should be blue.
- testString: assert($("h2").css("color") === "rgb(0, 0, 255)");
- - text: Your stylesheet h2 declaration should be valid with a semicolon and closing brace.
- testString: assert(code.match(/h2\s*\{\s*color\s*:.*;\s*\}/g));
- - text: All your style elements should be valid and have closing tags.
- testString: assert(code.match(/<\/style>/g) && code.match(/<\/style>/g).length === (code.match(/
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-for-specific-colors.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-for-specific-colors.md
index 67cc7e952a..9139746065 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-for-specific-colors.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-for-specific-colors.md
@@ -6,11 +6,13 @@ videoUrl: 'https://scrimba.com/c/c8W9mHM'
forumTopicId: 18350
---
-## Description
-
+# --description--
+
Did you know there are other ways to represent colors in CSS? One of these ways is called hexadecimal code, or hex code for short.
-We usually use decimals, or base 10 numbers, which use the symbols 0 to 9 for each digit. Hexadecimals (or hex) are base 16 numbers. This means it uses sixteen distinct symbols. Like decimals, the symbols 0-9 represent the values zero to nine. Then A,B,C,D,E,F represent the values ten to fifteen. Altogether, 0 to F can represent a digit in hexadecimal, giving us 16 total possible values. You can find more information about hexadecimal numbers here.
-In CSS, we can use 6 hexadecimal digits to represent colors, two each for the red (R), green (G), and blue (B) components. For example, #000000 is black and is also the lowest possible value. You can find more information about the RGB color system here.
+
+We usually use decimals, or base 10 numbers, which use the symbols 0 to 9 for each digit. Hexadecimals (or hex) are base 16 numbers. This means it uses sixteen distinct symbols. Like decimals, the symbols 0-9 represent the values zero to nine. Then A,B,C,D,E,F represent the values ten to fifteen. Altogether, 0 to F can represent a digit in hexadecimal, giving us 16 total possible values. You can find more information about [hexadecimal numbers here](https://en.wikipedia.org/wiki/Hexadecimal).
+
+In CSS, we can use 6 hexadecimal digits to represent colors, two each for the red (R), green (G), and blue (B) components. For example, `#000000` is black and is also the lowest possible value. You can find more information about the [RGB color system here](https://en.wikipedia.org/wiki/RGB_color_model).
```css
body {
@@ -18,31 +20,31 @@ body {
}
```
-
+# --instructions--
-## Instructions
-
-Replace the word black in our body element's background-color with its hex code representation, #000000.
-
+Replace the word `black` in our `body` element's background-color with its hex code representation, `#000000`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your body element should have the background-color of black.
- testString: assert($("body").css("background-color") === "rgb(0, 0, 0)");
- - text: The hex code for the color black should be used instead of the word black.
- testString: assert(code.match(/body\s*{(([\s\S]*;\s*?)|\s*?)background.*\s*:\s*?#000(000)?((\s*})|(;[\s\S]*?}))/gi));
+Your `body` element should have the background-color of black.
+```js
+assert($('body').css('background-color') === 'rgb(0, 0, 0)');
```
-
+The `hex code` for the color black should be used instead of the word `black`.
-## Challenge Seed
-
+```js
+assert(
+ code.match(
+ /body\s*{(([\s\S]*;\s*?)|\s*?)background.*\s*:\s*?#000(000)?((\s*})|(;[\s\S]*?}))/gi
+ )
+);
+```
-
+# --seed--
+
+## --seed-contents--
```html
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.md
index fe09f94e3d..cb46d20c9b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-hex-code-to-mix-colors.md
@@ -6,51 +6,77 @@ videoUrl: 'https://scrimba.com/c/cK89PhP'
forumTopicId: 18359
---
-## Description
-
+# --description--
+
To review, hex codes use 6 hexadecimal digits to represent colors, two each for red (R), green (G), and blue (B) components.
+
From these three pure colors (red, green, and blue), we can vary the amounts of each to create over 16 million other colors!
-For example, orange is pure red, mixed with some green, and no blue. In hex code, this translates to being #FFA500.
-The digit 0 is the lowest number in hex code, and represents a complete absence of color.
-The digit F is the highest number in hex code, and represents the maximum possible brightness.
-
-## Instructions
-
-Replace the color words in our style element with their correct hex codes.
-
Color
Hex Code
Dodger Blue
#1E90FF
Green
#00FF00
Orange
#FFA500
Red
#FF0000
-
+For example, orange is pure red, mixed with some green, and no blue. In hex code, this translates to being `#FFA500`.
-## Tests
-
+The digit `0` is the lowest number in hex code, and represents a complete absence of color.
-```yml
-tests:
- - text: Your h1 element with the text I am red! should be given the color red.
- testString: assert($('.red-text').css('color') === 'rgb(255, 0, 0)');
- - text: The hex code for the color red should be used instead of the word red.
- testString: assert(code.match(/\.red-text\s*?{\s*?color:\s*?(#FF0000|#F00)\s*?;\s*?}/gi));
- - text: Your h1 element with the text I am green! should be given the color green.
- testString: assert($('.green-text').css('color') === 'rgb(0, 255, 0)');
- - text: The hex code for the color green should be used instead of the word green.
- testString: assert(code.match(/\.green-text\s*?{\s*?color:\s*?(#00FF00|#0F0)\s*?;\s*?}/gi));
- - text: Your h1 element with the text I am dodger blue! should be given the color dodger blue.
- testString: assert($('.dodger-blue-text').css('color') === 'rgb(30, 144, 255)');
- - text: The hex code for the color dodger blue should be used instead of the word dodgerblue.
- testString: assert(code.match(/\.dodger-blue-text\s*?{\s*?color:\s*?#1E90FF\s*?;\s*?}/gi));
- - text: Your h1 element with the text I am orange! should be given the color orange.
- testString: assert($('.orange-text').css('color') === 'rgb(255, 165, 0)');
- - text: The hex code for the color orange should be used instead of the word orange.
- testString: assert(code.match(/\.orange-text\s*?{\s*?color:\s*?#FFA500\s*?;\s*?}/gi));
+The digit `F` is the highest number in hex code, and represents the maximum possible brightness.
+# --instructions--
+
+Replace the color words in our `style` element with their correct hex codes.
+
+
Color
Hex Code
Dodger Blue
#1E90FF
Green
#00FF00
Orange
#FFA500
Red
#FF0000
+
+# --hints--
+
+Your `h1` element with the text `I am red!` should be given the `color` red.
+
+```js
+assert($('.red-text').css('color') === 'rgb(255, 0, 0)');
```
-
+The `hex code` for the color red should be used instead of the word `red`.
-## Challenge Seed
-
+```js
+assert(code.match(/\.red-text\s*?{\s*?color:\s*?(#FF0000|#F00)\s*?;\s*?}/gi));
+```
-
+Your `h1` element with the text `I am green!` should be given the `color` green.
+
+```js
+assert($('.green-text').css('color') === 'rgb(0, 255, 0)');
+```
+
+The `hex code` for the color green should be used instead of the word `green`.
+
+```js
+assert(code.match(/\.green-text\s*?{\s*?color:\s*?(#00FF00|#0F0)\s*?;\s*?}/gi));
+```
+
+Your `h1` element with the text `I am dodger blue!` should be given the `color` dodger blue.
+
+```js
+assert($('.dodger-blue-text').css('color') === 'rgb(30, 144, 255)');
+```
+
+The `hex code` for the color dodger blue should be used instead of the word `dodgerblue`.
+
+```js
+assert(code.match(/\.dodger-blue-text\s*?{\s*?color:\s*?#1E90FF\s*?;\s*?}/gi));
+```
+
+Your `h1` element with the text `I am orange!` should be given the `color` orange.
+
+```js
+assert($('.orange-text').css('color') === 'rgb(255, 165, 0)');
+```
+
+The `hex code` for the color orange should be used instead of the word `orange`.
+
+```js
+assert(code.match(/\.orange-text\s*?{\s*?color:\s*?#FFA500\s*?;\s*?}/gi));
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-a-submit-button-to-a-form.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-a-submit-button-to-a-form.md
index d775d3d447..e393da5fc9 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-a-submit-button-to-a-form.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-a-submit-button-to-a-form.md
@@ -6,40 +6,55 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cp2Nkhz'
forumTopicId: 16627
---
-## Description
-
-Let's add a submit button to your form. Clicking this button will send the data from your form to the URL you specified with your form's action attribute.
+# --description--
+
+Let's add a `submit` button to your form. Clicking this button will send the data from your form to the URL you specified with your form's `action` attribute.
+
Here's an example submit button:
-<button type="submit">this button submits the form</button>
-
-## Instructions
-
-Add a button as the last element of your form element with a type of submit, and "Submit" as its text.
-
+``
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your form should have a button inside it.
- testString: assert($("form").children("button").length > 0);
- - text: Your submit button should have the attribute type set to submit.
- testString: assert($("button").attr("type") === "submit");
- - text: Your submit button should only have the text Submit.
- testString: assert($("button").text().match(/^\s*submit\s*$/gi));
- - text: Your button element should have a closing tag.
- testString: assert(code.match(/<\/button>/g) && code.match(/
+Your submit button should have the attribute `type` set to `submit`.
-## Challenge Seed
-
+```js
+assert($('button').attr('type') === 'submit');
+```
-
+Your submit button should only have the text `Submit`.
+
+```js
+assert(
+ $('button')
+ .text()
+ .match(/^\s*submit\s*$/gi)
+);
+```
+
+Your `button` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/button>/g) &&
+ code.match(//g).length === code.match(/CatPhotoApp
@@ -66,11 +81,7 @@ tests:
```
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -97,5 +108,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website.md
index b0c03dcd3c..57812567d5 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website.md
@@ -6,48 +6,67 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/c8EbJf2'
forumTopicId: 16640
---
-## Description
-
-You can add images to your website by using the img element, and point to a specific image's URL using the src attribute.
+# --description--
+
+You can add images to your website by using the `img` element, and point to a specific image's URL using the `src` attribute.
+
An example of this would be:
-<img src="https://www.freecatphotoapp.com/your-image.jpg">
-Note that img elements are self-closing.
-All img elements must have an alt attribute. The text inside an alt attribute is used for screen readers to improve accessibility and is displayed if the image fails to load.
-Note: If the image is purely decorative, using an empty alt attribute is a best practice.
-Ideally the alt attribute should not contain special characters unless needed.
-Let's add an alt attribute to our img example above:
-<img src="https://www.freecatphotoapp.com/your-image.jpg" alt="A business cat wearing a necktie.">
-
-## Instructions
-
+``
+
+Note that `img` elements are self-closing.
+
+All `img` elements **must** have an `alt` attribute. The text inside an `alt` attribute is used for screen readers to improve accessibility and is displayed if the image fails to load.
+
+**Note:** If the image is purely decorative, using an empty `alt` attribute is a best practice.
+
+Ideally the `alt` attribute should not contain special characters unless needed.
+
+Let's add an `alt` attribute to our `img` example above:
+
+``
+
+# --instructions--
+
Let's try to add an image to our website:
-Within the existing main element, insert an img element before the existing p elements.
-Now set the src attribute so that it points to this url:
-https://bit.ly/fcc-relaxing-cat
-Finally, don't forget to give your img element an alt attribute with applicable text.
-
-## Tests
-
+Within the existing `main` element, insert an `img` element before the existing `p` elements.
-```yml
-tests:
- - text: Your page should have an image element.
- testString: assert($("img").length);
- - text: Your image should have a src attribute that points to the kitten image.
- testString: assert(/^https:\/\/bit\.ly\/fcc-relaxing-cat$/i.test($("img").attr("src")));
- - text: Your image element's alt attribute should not be empty.
- testString: assert($("img").attr("alt") && $("img").attr("alt").length && /)\S+\1\S*\/?>/.test(__helpers.removeWhiteSpace(code)));
+Now set the `src` attribute so that it points to this url:
+`https://bit.ly/fcc-relaxing-cat`
+
+Finally, don't forget to give your `img` element an `alt` attribute with applicable text.
+
+# --hints--
+
+Your page should have an image element.
+
+```js
+assert($('img').length);
```
-
+Your image should have a `src` attribute that points to the kitten image.
-## Challenge Seed
-
+```js
+assert(/^https:\/\/bit\.ly\/fcc-relaxing-cat$/i.test($('img').attr('src')));
+```
-
Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.md
index 3b431ea3dd..e980905048 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.md
@@ -6,40 +6,55 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cKdJDhg'
forumTopicId: 16647
---
-## Description
-
-Placeholder text is what is displayed in your input element before your user has inputted anything.
+# --description--
+
+Placeholder text is what is displayed in your `input` element before your user has inputted anything.
+
You can create placeholder text like so:
-<input type="text" placeholder="this is placeholder text">
-Note: Remember that input elements are self-closing.
-
-## Instructions
-
-Set the placeholder value of your text input to "cat photo URL".
-
+``
-## Tests
-
+**Note:** Remember that `input` elements are self-closing.
-```yml
-tests:
- - text: You should add a placeholder attribute to the existing text input element.
- testString: assert($("input[placeholder]").length > 0);
- - text: You should set the value of your placeholder attribute to cat photo URL.
- testString: assert($("input") && $("input").attr("placeholder") && $("input").attr("placeholder").match(/cat\s+photo\s+URL/gi));
- - text: The finished input element should not have a closing tag.
- testString: assert(!code.match(/.*<\/input>/gi));
- - text: The finished input element should have valid syntax.
- testString: assert($("input[type=text]").length > 0);
+# --instructions--
+
+Set the `placeholder` value of your text `input` to "cat photo URL".
+
+# --hints--
+
+You should add a `placeholder` attribute to the existing text `input` element.
+
+```js
+assert($('input[placeholder]').length > 0);
```
-
+You should set the value of your placeholder attribute to `cat photo URL`.
-## Challenge Seed
-
+```js
+assert(
+ $('input') &&
+ $('input').attr('placeholder') &&
+ $('input')
+ .attr('placeholder')
+ .match(/cat\s+photo\s+URL/gi)
+);
+```
-
+The finished `input` element should not have a closing tag.
+
+```js
+assert(!code.match(/.*<\/input>/gi));
+```
+
+The finished `input` element should have valid syntax.
+
+```js
+assert($('input[type=text]').length > 0);
+```
+
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
@@ -64,14 +79,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -95,5 +103,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/check-radio-buttons-and-checkboxes-by-default.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/check-radio-buttons-and-checkboxes-by-default.md
index 72b231ec41..c6acc93c64 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/check-radio-buttons-and-checkboxes-by-default.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/check-radio-buttons-and-checkboxes-by-default.md
@@ -6,36 +6,35 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cWk3Qh6'
forumTopicId: 301094
---
-## Description
-
-You can set a checkbox or radio button to be checked by default using the checked attribute.
+# --description--
+
+You can set a checkbox or radio button to be checked by default using the `checked` attribute.
+
To do this, just add the word "checked" to the inside of an input element. For example:
-<input type="radio" name="test-name" checked>
-
-## Instructions
-
+``
+
+# --instructions--
+
Set the first of your radio buttons and the first of your checkboxes to both be checked by default.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your first radio button on your form should be checked by default.
- testString: assert($('input[type="radio"]').prop("checked"));
- - text: Your first checkbox on your form should be checked by default.
- testString: assert($('input[type="checkbox"]').prop("checked"));
+Your first radio button on your form should be checked by default.
+```js
+assert($('input[type="radio"]').prop('checked'));
```
-
+Your first checkbox on your form should be checked by default.
-## Challenge Seed
-
+```js
+assert($('input[type="checkbox"]').prop('checked'));
+```
-
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
@@ -68,14 +67,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -107,5 +99,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/comment-out-html.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/comment-out-html.md
index 40aca0bd9e..411af75b98 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/comment-out-html.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/comment-out-html.md
@@ -6,41 +6,55 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cGyGbca'
forumTopicId: 16782
---
-## Description
-
-Remember that in order to start a comment, you need to use <!-- and to end a comment, you need to use -->
-Here you'll need to end the comment before your h2 element begins.
-
+# --description--
-## Instructions
-
-Comment out your h1 element and your p element, but not your h2 element.
-
+Remember that in order to start a comment, you need to use ``
-## Tests
-
+Here you'll need to end the comment before your `h2` element begins.
-```yml
-tests:
- - text: Your h1 element should be commented out so that it is not visible on the page.
- testString: assert(($("h1").length === 0));
- - text: Your h2 element should not be commented out so that it is visible on the page.
- testString: assert(($("h2").length > 0));
- - text: Your p element should be commented out so that it is not visible on the page.
- testString: assert(($("p").length === 0));
- - text: Each of your comments should be closed with -->.
- testString: assert(code.match(/[^fc]-->/g).length > 1);
- - text: You should not change the order of the h1h2 or p in the code.
- testString: assert((code.match(/<([a-z0-9]){1,2}>/g)[0]==="
" && code.match(/<([a-z0-9]){1,2}>/g)[1]==="
" && code.match(/<([a-z0-9]){1,2}>/g)[2]==="
") );
+# --instructions--
+Comment out your `h1` element and your `p` element, but not your `h2` element.
+
+# --hints--
+
+Your `h1` element should be commented out so that it is not visible on the page.
+
+```js
+assert($('h1').length === 0);
```
-
+Your `h2` element should not be commented out so that it is visible on the page.
-## Challenge Seed
-
+```js
+assert($('h2').length > 0);
+```
-
+Your `p` element should be commented out so that it is not visible on the page.
+
+```js
+assert($('p').length === 0);
+```
+
+Each of your comments should be closed with `-->`.
+
+```js
+assert(code.match(/[^fc]-->/g).length > 1);
+```
+
+You should not change the order of the `h1` `h2` or `p` in the code.
+
+```js
+assert(
+ code.match(/<([a-z0-9]){1,2}>/g)[0] === '
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-bulleted-unordered-list.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-bulleted-unordered-list.md
index 1cd46f0a9f..49271fe89f 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-bulleted-unordered-list.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-bulleted-unordered-list.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cDKVPuv'
forumTopicId: 16814
---
-## Description
-
+# --description--
+
HTML has a special element for creating unordered lists, or bullet point style lists.
-Unordered lists start with an opening <ul> element, followed by any number of <li> elements. Finally, unordered lists close with a </ul>
+
+Unordered lists start with an opening `
` element, followed by any number of `
` elements. Finally, unordered lists close with a `
`
+
For example:
```html
@@ -20,36 +22,54 @@ For example:
```
would create a bullet point style list of "milk" and "cheese".
-
-## Instructions
-
-Remove the last two p elements and create an unordered list of three things that cats love at the bottom of the page.
-
+# --instructions--
-## Tests
-
+Remove the last two `p` elements and create an unordered list of three things that cats love at the bottom of the page.
-```yml
-tests:
- - text: Create a ul element.
- testString: assert($("ul").length > 0);
- - text: You should have three li elements within your ul element.
- testString: assert($("ul li").length > 2);
- - text: Your ul element should have a closing tag.
- testString: assert(code.match(/<\/ul>/gi) && code.match(/
/gi).length === code.match(/
li elements should have closing tags.
- testString: assert(code.match(/<\/li>/gi) && code.match(/
]/gi).length);
- - text: Your li elements should not contain an empty string or only white-space.
- testString: assert($("ul li").filter((_, item) => !$(item).text().trim()).length === 0);
+# --hints--
+
+Create a `ul` element.
+
+```js
+assert($('ul').length > 0);
```
-
+You should have three `li` elements within your `ul` element.
-## Challenge Seed
-
+```js
+assert($('ul li').length > 2);
+```
-
+Your `ul` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/ul>/gi) &&
+ code.match(/
]/gi).length
+);
+```
+
+Your `li` elements should not contain an empty string or only white-space.
+
+```js
+assert($('ul li').filter((_, item) => !$(item).text().trim()).length === 0);
+```
+
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
@@ -63,14 +83,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -86,5 +99,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.md
index 479fb67590..47f78e36a6 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-form-element.md
@@ -5,40 +5,51 @@ challengeType: 0
forumTopicId: 16817
---
-## Description
-
-You can build web forms that actually submit data to a server using nothing more than pure HTML. You can do this by specifying an action on your form element.
+# --description--
+
+You can build web forms that actually submit data to a server using nothing more than pure HTML. You can do this by specifying an action on your `form` element.
+
For example:
-<form action="/url-where-you-want-to-submit-form-data"></form>
-
-## Instructions
-
+``
-Nest the existing input element inside a form element and assign `"https://freecatphotoapp.com/submit-cat-photo"` to the action attribute of the form element.
+# --instructions--
-
+Nest the existing input element inside a `form` element and assign `"https://freecatphotoapp.com/submit-cat-photo"` to the `action` attribute of the `form` element.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: The existing input element should be nested within a form element.
- testString: const inputElem = document.querySelector('form input'); assert(inputElem.getAttribute('type') === 'text' && inputElem.getAttribute('placeholder') === 'cat photo URL');
- - text: Your form should have an action attribute which is set to https://freecatphotoapp.com/submit-cat-photo
- testString: assert($("form").attr("action") === "https://freecatphotoapp.com/submit-cat-photo");
- - text: Your form element should have well-formed open and close tags.
- testString: assert(code.match(/<\/form>/g) && code.match(/
+Your `form` should have an `action` attribute which is set to `https://freecatphotoapp.com/submit-cat-photo`
-## Challenge Seed
-
+```js
+assert(
+ $('form').attr('action') === 'https://freecatphotoapp.com/submit-cat-photo'
+);
+```
-
+Your `form` element should have well-formed open and close tags.
+
+```js
+assert(
+ code.match(/<\/form>/g) &&
+ code.match(/
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -96,5 +100,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.md
index a4c465641a..6b82d2d2cb 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.md
@@ -6,46 +6,67 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cqrkJsp'
forumTopicId: 16821
---
-## Description
-
+# --description--
+
Forms commonly use checkboxes for questions that may have more than one answer.
-Checkboxes are a type of input.
-Each of your checkboxes can be nested within its own label element. By wrapping an input element inside of a label element it will automatically associate the checkbox input with the label element surrounding it.
-All related checkbox inputs should have the same name attribute.
-It is considered best practice to explicitly define the relationship between a checkbox input and its corresponding label by setting the for attribute on the label element to match the id attribute of the associated input element.
+
+Checkboxes are a type of `input`.
+
+Each of your checkboxes can be nested within its own `label` element. By wrapping an `input` element inside of a `label` element it will automatically associate the checkbox input with the label element surrounding it.
+
+All related checkbox inputs should have the same `name` attribute.
+
+It is considered best practice to explicitly define the relationship between a checkbox `input` and its corresponding `label` by setting the `for` attribute on the `label` element to match the `id` attribute of the associated `input` element.
+
Here's an example of a checkbox:
-<label for="loving"><input id="loving" type="checkbox" name="personality"> Loving</label>
-
-## Instructions
-
-Add to your form a set of three checkboxes. Each checkbox should be nested within its own label element. All three should share the name attribute of personality.
-
+``
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your page should have three checkbox elements.
- testString: assert($('input[type="checkbox"]').length > 2);
- - text: Each of your three checkbox elements should be nested in its own label element.
- testString: assert($('label > input[type="checkbox"]:only-child').length > 2);
- - text: Make sure each of your label elements has a closing tag.
- testString: assert(code.match(/<\/label>/g) && code.match(/
+Each of your three checkbox elements should be nested in its own `label` element.
-## Challenge Seed
-
+```js
+assert($('label > input[type="checkbox"]:only-child').length > 2);
+```
-
+Make sure each of your `label` elements has a closing tag.
+
+```js
+assert(
+ code.match(/<\/label>/g) &&
+ code.match(//g).length === code.match(/ input[type="checkbox"]').filter('[name="personality"]').length > 2
+);
+```
+
+Each of your checkboxes should be added within the `form` tag.
+
+```js
+assert($('label').parent().get(0).tagName.match('FORM'));
+```
+
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
@@ -75,14 +96,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -116,5 +130,3 @@ name="personality">Evil
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.md
index d0ad14f343..0e9b62e60b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.md
@@ -5,12 +5,16 @@ challengeType: 0
forumTopicId: 16822
---
-## Description
-
+# --description--
+
You can use radio buttons for questions where you want the user to only give you one answer out of multiple options.
-Radio buttons are a type of input.
-Each of your radio buttons can be nested within its own label element. By wrapping an input element inside of a label element it will automatically associate the radio button input with the label element surrounding it.
-All related radio buttons should have the same name attribute to create a radio button group. By creating a radio group, selecting any single radio button will automatically deselect the other buttons within the same group ensuring only one answer is provided by the user.
+
+Radio buttons are a type of `input`.
+
+Each of your radio buttons can be nested within its own `label` element. By wrapping an `input` element inside of a `label` element it will automatically associate the radio button input with the label element surrounding it.
+
+All related radio buttons should have the same `name` attribute to create a radio button group. By creating a radio group, selecting any single radio button will automatically deselect the other buttons within the same group ensuring only one answer is provided by the user.
+
Here's an example of a radio button:
```html
@@ -19,7 +23,7 @@ Here's an example of a radio button:
```
-It is considered best practice to set a for attribute on the label element, with a value that matches the value of the id attribute of the input element. This allows assistive technologies to create a linked relationship between the label and the child input element. For example:
+It is considered best practice to set a `for` attribute on the `label` element, with a value that matches the value of the `id` attribute of the `input` element. This allows assistive technologies to create a linked relationship between the label and the child `input` element. For example:
```html
@@ -27,41 +31,69 @@ It is considered best practice to set a for attribute on the
```
-
+# --instructions--
-## Instructions
-
-Add a pair of radio buttons to your form, each nested in its own label element. One should have the option of indoor and the other should have the option of outdoor. Both should share the name attribute of indoor-outdoor to create a radio group.
-
+Add a pair of radio buttons to your form, each nested in its own `label` element. One should have the option of `indoor` and the other should have the option of `outdoor`. Both should share the `name` attribute of `indoor-outdoor` to create a radio group.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your page should have two radio button elements.
- testString: assert($('input[type="radio"]').length > 1);
- - text: Your radio buttons should be given the name attribute of indoor-outdoor.
- testString: assert($('input[type="radio"]').filter("[name='indoor-outdoor']").length > 1);
- - text: Each of your two radio button elements should be nested in its own label element.
- testString: assert($('label > input[type="radio"]:only-child').length > 1);
- - text: Each of your label elements should have a closing tag.
- testString: assert((code.match(/<\/label>/g) && code.match(//g).length === code.match(/indoor.
- testString: assert($("label").text().match(/indoor/gi));
- - text: One of your radio buttons should have the label outdoor.
- testString: assert($("label").text().match(/outdoor/gi));
- - text: Each of your radio button elements should be added within the form tag.
- testString: assert($("label").parent().get(0).tagName.match('FORM'));
+Your page should have two radio button elements.
+```js
+assert($('input[type="radio"]').length > 1);
```
-
+Your radio buttons should be given the `name` attribute of `indoor-outdoor`.
-## Challenge Seed
-
+```js
+assert($('input[type="radio"]').filter("[name='indoor-outdoor']").length > 1);
+```
-
+Each of your two radio button elements should be nested in its own `label` element.
+
+```js
+assert($('label > input[type="radio"]:only-child').length > 1);
+```
+
+Each of your `label` elements should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/label>/g) &&
+ code.match(//g).length === code.match(/CatPhotoApp
@@ -89,14 +121,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -125,5 +150,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-text-field.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-text-field.md
index e6bd91c74c..2ac0593014 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-text-field.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-text-field.md
@@ -6,36 +6,33 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/c2EVnf6'
forumTopicId: 16823
---
-## Description
-
+# --description--
+
Now let's create a web form.
-input elements are a convenient way to get input from your user.
+
+`input` elements are a convenient way to get input from your user.
+
You can create a text input like this:
-<input type="text">
-Note that input elements are self-closing.
-
-## Instructions
-
-Create an input element of type text below your lists.
-
+``
-## Tests
-
+Note that `input` elements are self-closing.
-```yml
-tests:
- - text: Your app should have an input element of type text.
- testString: assert($("input[type=text]").length > 0);
+# --instructions--
+Create an `input` element of type `text` below your lists.
+
+# --hints--
+
+Your app should have an `input` element of type `text`.
+
+```js
+assert($('input[type=text]').length > 0);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
CatPhotoApp
@@ -61,14 +58,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -90,9 +80,7 @@ tests:
other cats
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-an-ordered-list.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-an-ordered-list.md
index 12c7bcaf6b..0fa3fc5c79 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-an-ordered-list.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-an-ordered-list.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cQ3B8TM'
forumTopicId: 16824
---
-## Description
-
+# --description--
+
HTML has another special element for creating ordered lists, or numbered lists.
-Ordered lists start with an opening <ol> element, followed by any number of <li> elements. Finally, ordered lists are closed with the </ol> tag.
+
+Ordered lists start with an opening `` element, followed by any number of `
` elements. Finally, ordered lists are closed with the `
` tag.
For example:
@@ -21,49 +22,96 @@ For example:
```
would create a numbered list of "Garfield" and "Sylvester".
-
-## Instructions
-
+# --instructions--
+
Create an ordered list of the top 3 things cats hate the most.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should have an ordered list for Top 3 things cats hate:
- testString: assert((/Top 3 things cats hate:/i).test($("ol").prev().text()));
- - text: You should have an unordered list for Things cats love:
- testString: assert((/Things cats love:/i).test($("ul").prev().text()));
- - text: You should have only one ul element.
- testString: assert.equal($("ul").length, 1);
- - text: You should have only one ol element.
- testString: assert.equal($("ol").length, 1);
- - text: You should have three li elements within your ul element.
- testString: assert.equal($("ul li").length, 3);
- - text: You should have three li elements within your ol element.
- testString: assert.equal($("ol li").length, 3);
- - text: Your ul element should have a closing tag.
- testString: assert(code.match(/<\/ul>/g) && code.match(/<\/ul>/g).length === code.match(/
/g).length);
- - text: Your ol element should have a closing tag.
- testString: assert(code.match(/<\/ol>/g) && code.match(/<\/ol>/g).length === code.match(//g).length);
- - text: Your li element should have a closing tag.
- testString: assert(code.match(/<\/li>/g) && code.match(/
/g).length);
- - text: The li elements in your unordered list should not be empty.
- testString: $('ul li').each((i, val) => assert(__helpers.removeWhiteSpace(val.textContent)));
- - text: The li elements in your ordered list should not be empty.
- testString: $('ol li').each((i, val) => assert(!!__helpers.removeWhiteSpace(val.textContent)));
+You should have an ordered list for `Top 3 things cats hate:`
+```js
+assert(/Top 3 things cats hate:/i.test($('ol').prev().text()));
```
-
+You should have an unordered list for `Things cats love:`
-## Challenge Seed
-
+```js
+assert(/Things cats love:/i.test($('ul').prev().text()));
+```
-
+You should have only one `ul` element.
+
+```js
+assert.equal($('ul').length, 1);
+```
+
+You should have only one `ol` element.
+
+```js
+assert.equal($('ol').length, 1);
+```
+
+You should have three `li` elements within your `ul` element.
+
+```js
+assert.equal($('ul li').length, 3);
+```
+
+You should have three `li` elements within your `ol` element.
+
+```js
+assert.equal($('ol li').length, 3);
+```
+
+Your `ul` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/ul>/g) &&
+ code.match(/<\/ul>/g).length === code.match(/
/g).length
+);
+```
+
+Your `ol` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/ol>/g) &&
+ code.match(/<\/ol>/g).length === code.match(//g).length
+);
+```
+
+Your `li` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/li>/g) &&
+ code.match(/
/g).length
+);
+```
+
+The `li` elements in your unordered list should not be empty.
+
+```js
+$('ul li').each((i, val) =>
+ assert(__helpers.removeWhiteSpace(val.textContent))
+);
+```
+
+The `li` elements in your ordered list should not be empty.
+
+```js
+$('ol li').each((i, val) =>
+ assert(!!__helpers.removeWhiteSpace(val.textContent))
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
@@ -83,14 +131,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -113,5 +154,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/declare-the-doctype-of-an-html-document.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/declare-the-doctype-of-an-html-document.md
index 846e872e48..f5b9cbefe8 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/declare-the-doctype-of-an-html-document.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/declare-the-doctype-of-an-html-document.md
@@ -6,13 +6,18 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cra98AJ'
forumTopicId: 301095
---
-## Description
-
+# --description--
+
The challenges so far have covered specific HTML elements and their uses. However, there are a few elements that give overall structure to your page, and should be included in every HTML document.
+
At the top of your document, you need to tell the browser which version of HTML your page is using. HTML is an evolving language, and is updated regularly. Most major browsers support the latest specification, which is HTML5. However, older web pages may use previous versions of the language.
-You tell the browser this information by adding the <!DOCTYPE ...> tag on the first line, where the ... part is the version of HTML. For HTML5, you use <!DOCTYPE html>.
-The ! and uppercase DOCTYPE is important, especially for older browsers. The html is not case sensitive.
-Next, the rest of your HTML code needs to be wrapped in html tags. The opening <html> goes directly below the <!DOCTYPE html> line, and the closing </html> goes at the end of the page.
+
+You tell the browser this information by adding the `` tag on the first line, where the `...` part is the version of HTML. For HTML5, you use ``.
+
+The `!` and uppercase `DOCTYPE` is important, especially for older browsers. The `html` is not case sensitive.
+
+Next, the rest of your HTML code needs to be wrapped in `html` tags. The opening `` goes directly below the `` line, and the closing `` goes at the end of the page.
+
Here's an example of the page structure:
```html
@@ -22,54 +27,42 @@ Here's an example of the page structure:
```
-
+# --instructions--
-## Instructions
-
-Add a DOCTYPE tag for HTML5 to the top of the blank HTML document in the code editor. Under it, add opening and closing html tags, which wrap around an h1 element. The heading can include any text.
-
+Add a `DOCTYPE` tag for HTML5 to the top of the blank HTML document in the code editor. Under it, add opening and closing `html` tags, which wrap around an `h1` element. The heading can include any text.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should include a <!DOCTYPE html> tag.
- testString: assert(code.match(//gi));
- - text: There should be one html element.
- testString: assert($('html').length == 1);
- - text: The html tags should wrap around one h1 element.
- testString: assert(code.match(/\s*?
\s*?.*?\s*?<\/h1>\s*?<\/html>/gi));
+Your code should include a `` tag.
+```js
+assert(code.match(//gi));
```
-
-
-## Challenge Seed
-
-
-
-
-```html
+There should be one `html` element.
+```js
+assert($('html').length == 1);
```
-
+The `html` tags should wrap around one `h1` element.
+```js
+assert(code.match(/\s*?
-
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document.md
index 74084cd3a7..07be9ba667 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cra9bfP'
forumTopicId: 301096
---
-## Description
-
-You can add another level of organization in your HTML document within the html tags with the head and body elements. Any markup with information about your page would go into the head tag. Then any markup with the content of the page (what displays for a user) would go into the body tag.
-Metadata elements, such as link, meta, title, and style, typically go inside the head element.
+# --description--
+
+You can add another level of organization in your HTML document within the `html` tags with the `head` and `body` elements. Any markup with information about your page would go into the `head` tag. Then any markup with the content of the page (what displays for a user) would go into the `body` tag.
+
+Metadata elements, such as `link`, `meta`, `title`, and `style`, typically go inside the `head` element.
+
Here's an example of a page's layout:
```html
@@ -24,75 +26,90 @@ Here's an example of a page's layout:
```
-
+# --instructions--
-## Instructions
-
-Edit the markup so there's a head and a body. The head element should only include the title, and the body element should only include the h1 and p.
-
+Edit the markup so there's a `head` and a `body`. The `head` element should only include the `title`, and the `body` element should only include the `h1` and `p`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: There should be only one head element on the page.
- testString: |
- const headElems = code.replace(/\n/g,'').match(/\.*?\<\/head\s*>/g);
- assert(headElems && headElems.length === 1);
- - text: There should be only one body element on the page.
- testString: |
- const bodyElems = code.replace(/\n/g,'').match(/.*?<\/body\s*>/g);
- assert(bodyElems && bodyElems.length === 1);
- - text: The head element should be a child of the html element.
- testString: |
- const htmlChildren = code.replace(/\n/g,'').match(/(?.*)<\/html\s*>/);
- let foundHead;
- if(htmlChildren) {
- const { children } = htmlChildren.groups;
+There should be only one `head` element on the page.
- foundHead = children.match(/.*<\/head\s*>/);
- }
- assert(foundHead);
- - text: The body element should be a child of the html element.
- testString: |
- const htmlChildren = code.replace(/\n/g,'').match(/(?.*?)<\/html\s*>/);
- let foundBody;
- if(htmlChildren) {
- const { children } = htmlChildren.groups;
- foundBody = children.match(/.*<\/body\s*>/);
- }
- assert(foundBody);
- - text: The head element should wrap around the title element.
- testString: |
- const headChildren = code.replace(/\n/g,'').match(/(?.*?)<\/head\s*>/);
- let foundTitle;
- if(headChildren) {
- const { children } = headChildren.groups;
- foundTitle = children.match(/.*?<\/title\s*>/);
- }
- assert(foundTitle);
- - text: The body element should wrap around both the h1 and p elements.
- testString: |
- const bodyChildren = code.replace(/\n/g,'').match(/(?.*?)<\/body\s*>/);
- let foundElems;
- if(bodyChildren) {
- const { children } = bodyChildren.groups;
- const h1s = children.match(/
.*?\<\/head\s*>/g);
+assert(headElems && headElems.length === 1);
```
-
+There should be only one `body` element on the page.
-## Challenge Seed
-
+```js
+const bodyElems = code.replace(/\n/g, '').match(/.*?<\/body\s*>/g);
+assert(bodyElems && bodyElems.length === 1);
+```
-
+The `head` element should be a child of the `html` element.
+
+```js
+const htmlChildren = code
+ .replace(/\n/g, '')
+ .match(/(?.*)<\/html\s*>/);
+let foundHead;
+if (htmlChildren) {
+ const { children } = htmlChildren.groups;
+
+ foundHead = children.match(/.*<\/head\s*>/);
+}
+assert(foundHead);
+```
+
+The `body` element should be a child of the `html` element.
+
+```js
+const htmlChildren = code
+ .replace(/\n/g, '')
+ .match(/(?.*?)<\/html\s*>/);
+let foundBody;
+if (htmlChildren) {
+ const { children } = htmlChildren.groups;
+ foundBody = children.match(/.*<\/body\s*>/);
+}
+assert(foundBody);
+```
+
+The `head` element should wrap around the `title` element.
+
+```js
+const headChildren = code
+ .replace(/\n/g, '')
+ .match(/(?.*?)<\/head\s*>/);
+let foundTitle;
+if (headChildren) {
+ const { children } = headChildren.groups;
+ foundTitle = children.match(/.*?<\/title\s*>/);
+}
+assert(foundTitle);
+```
+
+The `body` element should wrap around both the `h1` and `p` elements.
+
+```js
+const bodyChildren = code
+ .replace(/\n/g, '')
+ .match(/(?.*?)<\/body\s*>/);
+let foundElems;
+if (bodyChildren) {
+ const { children } = bodyChildren.groups;
+ const h1s = children.match(/
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
-
@@ -127,5 +136,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/delete-html-elements.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/delete-html-elements.md
index 0e5d0d5d75..f4e0ecc0d5 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/delete-html-elements.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/delete-html-elements.md
@@ -6,37 +6,39 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/ckK73C9'
forumTopicId: 17559
---
-## Description
-
+# --description--
+
Our phone doesn't have much vertical space.
+
Let's remove the unnecessary elements so we can start building our CatPhotoApp.
-
-## Instructions
-
-Delete your h1 element so we can simplify our view.
-
+# --instructions--
-## Tests
-
+Delete your `h1` element so we can simplify our view.
-```yml
-tests:
- - text: Your h1 element should be deleted.
- testString: assert(!code.match(/
/gi) && !code.match(/<\/h1>/gi));
- - text: Your h2 element should be on the page.
- testString: assert(code.match(/
[\w\W]*<\/h2>/gi));
- - text: Your p element should be on the page.
- testString: assert(code.match(/
[\w\W]*<\/p>/gi));
+# --hints--
+Your `h1` element should be deleted.
+
+```js
+assert(!code.match(/
/gi) && !code.match(/<\/h1>/gi));
```
-
+Your `h2` element should be on the page.
-## Challenge Seed
-
+```js
+assert(code.match(/
[\w\W]*<\/h2>/gi));
+```
-
+Your `p` element should be on the page.
+
+```js
+assert(code.match(/
Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
CatPhotoApp
Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/fill-in-the-blank-with-placeholder-text.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/fill-in-the-blank-with-placeholder-text.md
index a04cd7ac6a..8cfd4331de 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/fill-in-the-blank-with-placeholder-text.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/fill-in-the-blank-with-placeholder-text.md
@@ -6,34 +6,29 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cgR7Dc7'
forumTopicId: 18178
---
-## Description
-
+# --description--
+
Web developers traditionally use lorem ipsum text as placeholder text. The lorem ipsum text is randomly scraped from a famous passage by Cicero of Ancient Rome.
+
Lorem ipsum text has been used as placeholder text by typesetters since the 16th century, and this tradition continues on the web.
+
Well, 5 centuries is long enough. Since we're building a CatPhotoApp, let's use something called "kitty ipsum text".
-
-## Instructions
-
-Replace the text inside your p element with the first few words of this kitty ipsum text: Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.
-
+# --instructions--
-## Tests
-
+Replace the text inside your `p` element with the first few words of this kitty ipsum text: `Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.`
-```yml
-tests:
- - text: Your p element should contain the first few words of the provided kitty ipsum text.
- testString: assert.isTrue((/Kitty(\s)+ipsum/gi).test($("p").text()));
+# --hints--
+Your `p` element should contain the first few words of the provided `kitty ipsum text`.
+
+```js
+assert.isTrue(/Kitty(\s)+ipsum/gi.test($('p').text()));
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
Hello World
@@ -43,14 +38,7 @@ tests:
Hello Paragraph
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
Hello World
@@ -59,5 +47,3 @@ tests:
Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-element.md
index a67f08b4ee..90de6d2228 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-element.md
@@ -6,62 +6,64 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cE8Gqf3'
forumTopicId: 18196
---
-## Description
-
+# --description--
+
Over the next few lessons, we'll build an HTML5 cat photo web app piece-by-piece.
-The h2 element you will be adding in this step will add a level two heading to the web page.
-This element tells the browser about the structure of your website. h1 elements are often used for main headings, while h2 elements are generally used for subheadings. There are also h3, h4, h5 and h6 elements to indicate different levels of subheadings.
-
-## Instructions
-
-Add an h2 tag that says "CatPhotoApp" to create a second HTML element below your "Hello World" h1 element.
-
+The `h2` element you will be adding in this step will add a level two heading to the web page.
-## Tests
-
+This element tells the browser about the structure of your website. `h1` elements are often used for main headings, while `h2` elements are generally used for subheadings. There are also `h3`, `h4`, `h5` and `h6` elements to indicate different levels of subheadings.
-```yml
-tests:
- - text: You should create an h2 element.
- testString: assert(($("h2").length > 0));
- - text: Your h2 element should have a closing tag.
- testString: assert(code.match(/<\/h2>/g) && code.match(/<\/h2>/g).length === code.match(/
/g).length);
- - text: Your h2 element should have the text CatPhotoApp.
- testString: assert.isTrue((/cat(\s)?photo(\s)?app/gi).test($("h2").text()));
- - text: Your h1 element should have the text Hello World.
- testString: assert.isTrue((/hello(\s)+world/gi).test($("h1").text()));
- - text: Your h1 element should be before your h2 element.
- testString: assert(code.match(/
\s*?.*?\s*?<\/h1>\s*
\s*?.*?\s*?<\/h2>/gi));
+# --instructions--
+Add an `h2` tag that says "CatPhotoApp" to create a second HTML element below your "Hello World" `h1` element.
+
+# --hints--
+
+You should create an `h2` element.
+
+```js
+assert($('h2').length > 0);
```
-
+Your `h2` element should have a closing tag.
-## Challenge Seed
-
+```js
+assert(
+ code.match(/<\/h2>/g) &&
+ code.match(/<\/h2>/g).length === code.match(/
/g).length
+);
+```
-
+Your `h2` element should have the text `CatPhotoApp`.
+
+```js
+assert.isTrue(/cat(\s)?photo(\s)?app/gi.test($('h2').text()));
+```
+
+Your `h1` element should have the text `Hello World`.
+
+```js
+assert.isTrue(/hello(\s)+world/gi.test($('h1').text()));
+```
+
+Your `h1` element should be before your `h2` element.
+
+```js
+assert(code.match(/
```
-
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/inform-with-the-paragraph-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/inform-with-the-paragraph-element.md
index 5df9b51b09..2c9eb793be 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/inform-with-the-paragraph-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/inform-with-the-paragraph-element.md
@@ -6,58 +6,56 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/ceZ7DtN'
forumTopicId: 18202
---
-## Description
-
-p elements are the preferred element for paragraph text on websites. p is short for "paragraph".
+# --description--
+
+`p` elements are the preferred element for paragraph text on websites. `p` is short for "paragraph".
+
You can create a paragraph element like this:
-<p>I'm a p tag!</p>
-
-## Instructions
-
-Create a p element below your h2 element, and give it the text "Hello Paragraph".
-Note: As a convention, all HTML tags are written in lowercase, for example <p></p> and not <P></P>.
-
+`
I'm a p tag!
`
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should have a valid p element.
- testString: assert(($("p").length > 0));
- - text: Your p element should have the text Hello Paragraph.
- testString: assert.isTrue((/hello(\s)+paragraph/gi).test($("p").text()));
- - text: Your p element should have a closing tag.
- testString: assert(code.match(/<\/p>/g) && code.match(/<\/p>/g).length === code.match(/` and not ``.
+
+# --hints--
+
+Your code should have a valid `p` element.
+
+```js
+assert($('p').length > 0);
```
-
+Your `p` element should have the text `Hello Paragraph`.
-## Challenge Seed
-
+```js
+assert.isTrue(/hello(\s)+paragraph/gi.test($('p').text()));
+```
-
+Your `p` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/p>/g) &&
+ code.match(/<\/p>/g).length === code.match(/
Hello World
CatPhotoApp
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
Hello World
CatPhotoApp
Hello Paragraph
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/introduction-to-html5-elements.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/introduction-to-html5-elements.md
index 18f41062f2..5759736126 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/introduction-to-html5-elements.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/introduction-to-html5-elements.md
@@ -6,11 +6,13 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cBkZGpt7'
forumTopicId: 301097
---
-## Description
-
-HTML5 introduces more descriptive HTML tags. These include main, header, footer, nav, video, article, section and others.
-These tags give a descriptive structure to your HTML, make your HTML easier to read, and help with Search Engine Optimization (SEO) and accessibility. The main HTML5 tag helps search engines and other developers find the main content of your page.
-Example usage, a main element with two child elements nested inside it:
+# --description--
+
+HTML5 introduces more descriptive HTML tags. These include `main`, `header`, `footer`, `nav`, `video`, `article`, `section` and others.
+
+These tags give a descriptive structure to your HTML, make your HTML easier to read, and help with Search Engine Optimization (SEO) and accessibility. The `main` HTML5 tag helps search engines and other developers find the main content of your page.
+
+Example usage, a `main` element with two child elements nested inside it:
```html
@@ -19,43 +21,64 @@ Example usage, a main element with two child elements nested inside
```
-Note: Many of the new HTML5 tags and their benefits are covered in the Applied Accessibility section.
-
+**Note:** Many of the new HTML5 tags and their benefits are covered in the Applied Accessibility section.
-## Instructions
-
-Create a second p element after the existing p element with the following kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.
-Then, create a main element and nest the two p elements inside the main element.
-
+# --instructions--
-## Tests
-
+Create a second `p` element after the existing `p` element with the following kitty ipsum text: `Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.`
-```yml
-tests:
- - text: You should have 2 p elements with Kitty Ipsum text.
- testString: assert($("p").length > 1);
- - text: Each of your p elements should have a closing tag.
- testString: assert(code.match(/<\/p>/g) && code.match(/<\/p>/g).length === code.match(/
p element should contain the first few words of the provided additional kitty ipsum text.
- testString: assert.isTrue((/Purr\s+jump\s+eat/gi).test($("p").text()));
- - text: Your code should have one main element.
- testString: assert($('main').length === 1);
- - text: The main element should have two paragraph elements as children.
- testString: assert($("main").children("p").length === 2);
- - text: The opening main tag should come before the first paragraph tag.
- testString: assert(code.match(/\s*?
/g));
- - text: The closing main tag should come after the second closing paragraph tag.
- testString: assert(code.match(/<\/p>\s*?<\/main>/g));
+Then, create a `main` element and nest the two `p` elements inside the `main` element.
+# --hints--
+
+You should have 2 `p` elements with Kitty Ipsum text.
+
+```js
+assert($('p').length > 1);
```
-
+Each of your `p` elements should have a closing tag.
-## Challenge Seed
-
+```js
+assert(
+ code.match(/<\/p>/g) &&
+ code.match(/<\/p>/g).length === code.match(/
+Your `p` element should contain the first few words of the provided additional `kitty ipsum text`.
+
+```js
+assert.isTrue(/Purr\s+jump\s+eat/gi.test($('p').text()));
+```
+
+Your code should have one `main` element.
+
+```js
+assert($('main').length === 1);
+```
+
+The `main` element should have two paragraph elements as children.
+
+```js
+assert($('main').children('p').length === 2);
+```
+
+The opening `main` tag should come before the first paragraph tag.
+
+```js
+assert(code.match(/\s*?
/g));
+```
+
+The closing `main` tag should come after the second closing paragraph tag.
+
+```js
+assert(code.match(/<\/p>\s*?<\/main>/g));
+```
+
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
@@ -63,14 +86,7 @@ tests:
Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -79,5 +95,3 @@ tests:
Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.md
index 8f7256936b..441b1a5088 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.md
@@ -6,39 +6,46 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/c8EkncB'
forumTopicId: 18226
---
-## Description
-
-You can use a (anchor) elements to link to content outside of your web page.
-a elements need a destination web address called an href attribute. They also need anchor text. Here's an example:
-<a href="https://freecodecamp.org">this links to freecodecamp.org</a>
-Then your browser will display the text "this links to freecodecamp.org" as a link you can click. And that link will take you to the web address https://www.freecodecamp.org.
-
+# --description--
-## Instructions
-
-Create an a element that links to https://freecatphotoapp.com and has "cat photos" as its anchor text.
-
+You can use `a` (*anchor*) elements to link to content outside of your web page.
-## Tests
-
+`a` elements need a destination web address called an `href` attribute. They also need anchor text. Here's an example:
-```yml
-tests:
- - text: Your a element should have the anchor text of "cat photos".
- testString: assert((/cat photos/gi).test($("a").text()));
- - text: You need an a element that links to https://freecatphotoapp.com
- testString: assert(/https:\/\/(www\.)?freecatphotoapp\.com/gi.test($("a").attr("href")));
- - text: Your a element should have a closing tag.
- testString: assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/this links to freecodecamp.org`
+Then your browser will display the text **"this links to freecodecamp.org"** as a link you can click. And that link will take you to the web address **`https://www.freecodecamp.org`**.
+
+# --instructions--
+
+Create an `a` element that links to `https://freecatphotoapp.com` and has "cat photos" as its anchor text.
+
+# --hints--
+
+Your `a` element should have the anchor text of "cat photos".
+
+```js
+assert(/cat photos/gi.test($('a').text()));
```
-
+You need an `a` element that links to `https://freecatphotoapp.com`
-## Challenge Seed
-
+```js
+assert(/https:\/\/(www\.)?freecatphotoapp\.com/gi.test($('a').attr('href')));
+```
-
+Your `a` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/a>/g) &&
+ code.match(/<\/a>/g).length === code.match(/CatPhotoApp
@@ -53,14 +60,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -73,5 +73,3 @@ tests:
Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-internal-sections-of-a-page-with-anchor-elements.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-internal-sections-of-a-page-with-anchor-elements.md
index babba0f59b..2aefd034c6 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-internal-sections-of-a-page-with-anchor-elements.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-internal-sections-of-a-page-with-anchor-elements.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cyrDRUL'
forumTopicId: 301098
---
-## Description
-
-a (anchor) elements can also be used to create internal links to jump to different sections within a webpage.
-To create an internal link, you assign a link's href attribute to a hash symbol # plus the value of the id attribute for the element that you want to internally link to, usually further down the page. You then need to add the same id attribute to the element you are linking to. An id is an attribute that uniquely describes an element.
+# --description--
+
+`a` (*anchor*) elements can also be used to create internal links to jump to different sections within a webpage.
+
+To create an internal link, you assign a link's `href` attribute to a hash symbol `#` plus the value of the `id` attribute for the element that you want to internally link to, usually further down the page. You then need to add the same `id` attribute to the element you are linking to. An `id` is an attribute that uniquely describes an element.
+
Below is an example of an internal anchor link and its target element:
```html
@@ -18,42 +20,65 @@ Below is an example of an internal anchor link and its target element:
Contacts
```
-When users click the Contacts link, they'll be taken to the section of the webpage with the Contacts header element.
-
+When users click the Contacts link, they'll be taken to the section of the webpage with the **Contacts** header element.
-## Instructions
-
-Change your external link to an internal link by changing the href attribute to "#footer" and the text from "cat photos" to "Jump to Bottom".
-Remove the target="_blank" attribute from the anchor tag since this causes the linked document to open in a new window tab.
-Then add an id attribute with a value of "footer" to the <footer> element at the bottom of the page.
-
+# --instructions--
-## Tests
-
+Change your external link to an internal link by changing the `href` attribute to "#footer" and the text from "cat photos" to "Jump to Bottom".
-```yml
-tests:
- - text: There should be only one anchor tag on your page.
- testString: assert($('a').length == 1);
- - text: There should be only one footer tag on your page.
- testString: assert($('footer').length == 1);
- - text: The a tag should have an href attribute set to "#footer".
- testString: assert($('a').eq(0).attr('href') == "#footer");
- - text: The a tag should not have a target attribute
- testString: assert(typeof $('a').eq(0).attr('target') == typeof undefined || $('a').eq(0).attr('target') == true);
- - text: The a text should be "Jump to Bottom".
- testString: assert($('a').eq(0).text().match(/Jump to Bottom/gi));
- - text: The footer tag should have an id attribute set to "footer".
- testString: assert($('footer').eq(0).attr('id') == "footer");
+Remove the `target="_blank"` attribute from the anchor tag since this causes the linked document to open in a new window tab.
+Then add an `id` attribute with a value of "footer" to the `
+There should be only one `footer` tag on your page.
-## Challenge Seed
-
+```js
+assert($('footer').length == 1);
+```
-
+The `a` tag should have an `href` attribute set to "#footer".
+
+```js
+assert($('a').eq(0).attr('href') == '#footer');
+```
+
+The `a` tag should not have a `target` attribute
+
+```js
+assert(
+ typeof $('a').eq(0).attr('target') == typeof undefined ||
+ $('a').eq(0).attr('target') == true
+);
+```
+
+The `a` text should be "Jump to Bottom".
+
+```js
+assert(
+ $('a')
+ .eq(0)
+ .text()
+ .match(/Jump to Bottom/gi)
+);
+```
+
+The `footer` tag should have an `id` attribute set to "footer".
+
+```js
+assert($('footer').eq(0).attr('id') == 'footer');
+```
+
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
@@ -73,12 +98,7 @@ tests:
```
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -97,5 +117,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/make-dead-links-using-the-hash-symbol.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/make-dead-links-using-the-hash-symbol.md
index 42e224c630..f1bff11949 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/make-dead-links-using-the-hash-symbol.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/make-dead-links-using-the-hash-symbol.md
@@ -6,34 +6,29 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cMdkytL'
forumTopicId: 18230
---
-## Description
-
-Sometimes you want to add a elements to your website before you know where they will link.
-This is also handy when you're changing the behavior of a link using JavaScript, which we'll learn about later.
-
+# --description--
-## Instructions
-
-The current value of the href attribute is a link that points to "https://freecatphotoapp.com". Replace the href attribute value with a #, also known as a hash symbol, to create a dead link.
-For example: href="#"
-
+Sometimes you want to add `a` elements to your website before you know where they will link.
-## Tests
-
+This is also handy when you're changing the behavior of a link using `JavaScript`, which we'll learn about later.
-```yml
-tests:
- - text: Your a element should be a dead link with the value of the href attribute set to "#".
- testString: assert($("a").attr("href") === "#");
+# --instructions--
+The current value of the `href` attribute is a link that points to "`https://freecatphotoapp.com`". Replace the `href` attribute value with a `#`, also known as a hash symbol, to create a dead link.
+
+For example: `href="#"`
+
+# --hints--
+
+Your `a` element should be a dead link with the value of the `href` attribute set to "#".
+
+```js
+assert($('a').attr('href') === '#');
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
CatPhotoApp
@@ -47,14 +42,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -67,5 +55,3 @@ tests:
Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-an-anchor-element-within-a-paragraph.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-an-anchor-element-within-a-paragraph.md
index 30e2449185..6adefacca7 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-an-anchor-element-within-a-paragraph.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-an-anchor-element-within-a-paragraph.md
@@ -6,8 +6,7 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cb6k8Cb'
forumTopicId: 18244
---
-## Description
-
+# --description--
You can nest links within other text elements.
@@ -17,51 +16,102 @@ You can nest links within other text elements.
```
-Let's break down the example:
-Normal text is wrapped in the p element: <p> Here's a ... for you to follow. </p>
-Next is the anchor element <a> (which requires a closing tag </a>): <a> ... </a>
-target is an anchor tag attribute that specifies where to open the link and the value "_blank" specifies to open the link in a new tab
-href is an anchor tag attribute that contains the URL address of the link: ` ... `
-The text, "link to freecodecamp.org", within the a element called anchor text, will display a link to click: <a href=" ... ">link to freecodecamp.org</a>
-The final output of the example will look like this:
-
+Let's break down the example: Normal text is wrapped in the `p` element:
+`
Here's a ... for you to follow.
` Next is the *anchor* element `` (which requires a closing tag ``):
+` ... ` `target` is an anchor tag attribute that specifies where to open the link and the value `"_blank"` specifies to open the link in a new tab `href` is an anchor tag attribute that contains the URL address of the link:
+` ... ` The text, **"link to freecodecamp.org"**, within the `a` element called `anchor text`, will display a link to click:
+`link to freecodecamp.org` The final output of the example will look like this:
-## Instructions
-
+Here's a [link to freecodecamp.org](http://freecodecamp.org) for you to follow.
-Nest the existing a element within a new p element. The new paragraph should have text that says "View more cat photos", where "cat photos" is a link, and the rest is plain text.
-
+# --instructions--
-## Tests
-
+Nest the existing `a` element within a new `p` element. The new paragraph should have text that says "View more cat photos", where "cat photos" is a link, and the rest is plain text.
-```yml
-tests:
- - text: You should have an a element that links to "https://freecatphotoapp.com".
- testString: assert(($("a[href=\"https://freecatphotoapp.com\"]").length > 0 || $("a[href=\"http://www.freecatphotoapp.com\"]").length > 0));
- - text: Your a element should have the anchor text of "cat photos"
- testString: assert($("a").text().match(/cat\sphotos/gi));
- - text: You should create a new p element around your a element. There should be at least 3 total p tags in your HTML code.
- testString: assert($("p") && $("p").length > 2);
- - text: Your a element should be nested within your new p element.
- testString: assert(($("a[href=\"https://freecatphotoapp.com\"]").parent().is("p") || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().is("p")));
- - text: Your p element should have the text "View more " (with a space after it).
- testString: assert(($("a[href=\"https://freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi) || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi)));
- - text: Your a element should not have the text "View more".
- testString: assert(!$("a").text().match(/View\smore/gi));
- - text: Each of your p elements should have a closing tag.
- testString: assert(code.match(/<\/p>/g) && code.match(/
+Your `a` element should have the anchor text of "cat photos"
-## Challenge Seed
-
+```js
+assert(
+ $('a')
+ .text()
+ .match(/cat\sphotos/gi)
+);
+```
-
+You should create a new `p` element around your `a` element. There should be at least 3 total `p` tags in your HTML code.
+
+```js
+assert($('p') && $('p').length > 2);
+```
+
+Your `a` element should be nested within your new `p` element.
+
+```js
+assert(
+ $('a[href="https://freecatphotoapp.com"]').parent().is('p') ||
+ $('a[href="http://www.freecatphotoapp.com"]').parent().is('p')
+);
+```
+
+Your `p` element should have the text "View more " (with a space after it).
+
+```js
+assert(
+ $('a[href="https://freecatphotoapp.com"]')
+ .parent()
+ .text()
+ .match(/View\smore\s/gi) ||
+ $('a[href="http://www.freecatphotoapp.com"]')
+ .parent()
+ .text()
+ .match(/View\smore\s/gi)
+);
+```
+
+Your `a` element should not have the text "View more".
+
+```js
+assert(
+ !$('a')
+ .text()
+ .match(/View\smore/gi)
+);
+```
+
+Each of your `p` elements should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/p>/g) &&
+ code.match(/
Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-many-elements-within-a-single-div-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-many-elements-within-a-single-div-element.md
index bd759c8435..d72c63c8d0 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-many-elements-within-a-single-div-element.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-many-elements-within-a-single-div-element.md
@@ -6,41 +6,52 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cNW4kC3'
forumTopicId: 18246
---
-## Description
-
-The div element, also known as a division element, is a general purpose container for other elements.
-The div element is probably the most commonly used HTML element of all.
-Just like any other non-self-closing element, you can open a div element with <div> and close it on another line with </div>.
-
+# --description--
-## Instructions
-
-Nest your "Things cats love" and "Things cats hate" lists all within a single div element.
-Hint: Try putting your opening div tag above your "Things cats love" p element and your closing div tag after your closing ol tag so that both of your lists are within one div.
-
+The `div` element, also known as a division element, is a general purpose container for other elements.
-## Tests
-
+The `div` element is probably the most commonly used HTML element of all.
-```yml
-tests:
- - text: Your p elements should be nested inside your div element.
- testString: assert($("div").children("p").length > 1);
- - text: Your ul element should be nested inside your div element.
- testString: assert($("div").children("ul").length > 0);
- - text: Your ol element should be nested inside your div element.
- testString: assert($("div").children("ol").length > 0);
- - text: Your div element should have a closing tag.
- testString: assert(code.match(/<\/div>/g) && code.match(/<\/div>/g).length === code.match(/
/g).length);
+Just like any other non-self-closing element, you can open a `div` element with `
` and close it on another line with `
`.
+# --instructions--
+
+Nest your "Things cats love" and "Things cats hate" lists all within a single `div` element.
+
+Hint: Try putting your opening `div` tag above your "Things cats love" `p` element and your closing `div` tag after your closing `ol` tag so that both of your lists are within one `div`.
+
+# --hints--
+
+Your `p` elements should be nested inside your `div` element.
+
+```js
+assert($('div').children('p').length > 1);
```
-
+Your `ul` element should be nested inside your `div` element.
-## Challenge Seed
-
+```js
+assert($('div').children('ul').length > 0);
+```
-
+Your `ol` element should be nested inside your `div` element.
+
+```js
+assert($('div').children('ol').length > 0);
+```
+
+Your `div` element should have a closing tag.
+
+```js
+assert(
+ code.match(/<\/div>/g) &&
+ code.match(/<\/div>/g).length === code.match(/
@@ -114,5 +118,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/say-hello-to-html-elements.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/say-hello-to-html-elements.md
index 54e6da1064..19f1db58ff 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/say-hello-to-html-elements.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/say-hello-to-html-elements.md
@@ -6,57 +6,50 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cE8Gpt2'
forumTopicId: 18276
---
-## Description
-
+# --description--
+
Welcome to freeCodeCamp's HTML coding challenges. These will walk you through web development step-by-step.
+
First, you'll start by building a simple web page using HTML. You can edit code in your code editor, which is embedded into this web page.
-Do you see the code in your code editor that says <h1>Hello</h1>? That's an HTML element.
+
+Do you see the code in your code editor that says `
Hello
`? That's an HTML element.
+
Most HTML elements have an opening tag and a closing tag.
+
Opening tags look like this:
-<h1>
+
+`
`
+
Closing tags look like this:
-</h1>
+
+`
`
+
The only difference between opening and closing tags is the forward slash after the opening bracket of a closing tag.
+
Each challenge has tests you can run at any time by clicking the "Run tests" button. When you pass all tests, you'll be prompted to submit your solution and go to the next coding challenge.
-
-## Instructions
-
-To pass the test on this challenge, change your h1 element's text to say "Hello World".
-
+# --instructions--
-## Tests
-
+To pass the test on this challenge, change your `h1` element's text to say "Hello World".
-```yml
-tests:
- - text: Your h1 element should have the text "Hello World".
- testString: assert.isTrue((/hello(\s)+world/gi).test($('h1').text()));
+# --hints--
+Your `h1` element should have the text "Hello World".
+
+```js
+assert.isTrue(/hello(\s)+world/gi.test($('h1').text()));
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
Hello
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
Hello World
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/turn-an-image-into-a-link.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/turn-an-image-into-a-link.md
index 18821efcc0..03d0f86f85 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/turn-an-image-into-a-link.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/turn-an-image-into-a-link.md
@@ -6,40 +6,49 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cRdBnUr'
forumTopicId: 18327
---
-## Description
-
-You can make elements into links by nesting them within an a element.
-Nest your image within an a element. Here's an example:
-<a href="#"><img src="https://bit.ly/fcc-running-cats" alt="Three kittens running towards the camera."></a>
-Remember to use # as your a element's href property in order to turn it into a dead link.
-
+# --description--
+
+You can make elements into links by nesting them within an `a` element.
+
+Nest your image within an `a` element. Here's an example:
+
+``
+
+Remember to use `#` as your `a` element's `href` property in order to turn it into a dead link.
+
+# --instructions--
+
+Place the existing image element within an `a` (*anchor*) element.
-## Instructions
-
-Place the existing image element within an a (anchor) element.
Once you've done this, hover over your image with your cursor. Your cursor's normal pointer should become the link clicking pointer. The photo is now a link.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: The existing img element should be nested within an a element.
- testString: assert($("a").children("img").length > 0);
- - text: Your a element should be a dead link with a href attribute set to #.
- testString: assert(new RegExp("#").test($("a").children("img").parent().attr("href")));
- - text: Each of your a elements should have a closing tag.
- testString: assert(code.match(/<\/a>/g) && code.match(//g).length === code.match(/ 0);
```
-
+Your `a` element should be a dead link with a `href` attribute set to `#`.
-## Challenge Seed
-
+```js
+assert(new RegExp('#').test($('a').children('img').parent().attr('href')));
+```
-
Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/uncomment-html.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/uncomment-html.md
index 666dcc27a8..8f4d6ac1ff 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/uncomment-html.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/uncomment-html.md
@@ -6,40 +6,47 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cBmG9T7'
forumTopicId: 18329
---
-## Description
-
+# --description--
+
Commenting is a way that you can leave comments for other developers within your code without affecting the resulting output that is displayed to the end user.
+
Commenting is also a convenient way to make code inactive without having to delete it entirely.
-Comments in HTML start with <!-- and end with a -->
-
-## Instructions
-
-Uncomment your h1, h2 and p elements.
-
+Comments in HTML start with ``
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your h1 element should be visible on the page by uncommenting it.
- testString: assert($("h1").length > 0);
- - text: Your h2 element should be visible on the page by uncommenting it.
- testString: assert($("h2").length > 0);
- - text: Your p element should be visible on the page by uncommenting it.
- testString: assert($("p").length > 0);
- - text: No trailing comment tags should be visible on the page (i.e. -->).
- testString: assert(!$('*:contains("-->")')[1]);
+Uncomment your `h1`, `h2` and `p` elements.
+# --hints--
+
+Your `h1` element should be visible on the page by uncommenting it.
+
+```js
+assert($('h1').length > 0);
```
-
+Your `h2` element should be visible on the page by uncommenting it.
-## Challenge Seed
-
+```js
+assert($('h2').length > 0);
+```
-
+Your `p` element should be visible on the page by uncommenting it.
+
+```js
+assert($('p').length > 0);
+```
+
+No trailing comment tags should be visible on the page (i.e. `-->`).
+
+```js
+assert(!$('*:contains("-->")')[1]);
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
Hello World
@@ -67,5 +67,3 @@ tests:
Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-html5-to-require-a-field.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-html5-to-require-a-field.md
index cb7747f70b..607359ceb4 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-html5-to-require-a-field.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-html5-to-require-a-field.md
@@ -6,34 +6,29 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cMd4EcQ'
forumTopicId: 18360
---
-## Description
-
+# --description--
+
You can require specific form fields so that your user will not be able to submit your form until he or she has filled them out.
-For example, if you wanted to make a text input field required, you can just add the attribute required within your input element, like this: <input type="text" required>
-
-## Instructions
-
-Make your text input a required field, so that your user can't submit the form without completing this field.
+For example, if you wanted to make a text input field required, you can just add the attribute `required` within your `input` element, like this: ``
+
+# --instructions--
+
+Make your text `input` a `required` field, so that your user can't submit the form without completing this field.
+
Then try to submit the form without inputting any text. See how your HTML5 form notifies you that the field is required?
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your text input element should have the required attribute.
- testString: assert($("input").prop("required"));
+Your text `input` element should have the `required` attribute.
+```js
+assert($('input').prop('required'));
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
CatPhotoApp
@@ -61,14 +56,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -95,5 +83,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-the-value-attribute-with-radio-buttons-and-checkboxes.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-the-value-attribute-with-radio-buttons-and-checkboxes.md
index e040d086e9..4a0a8fbc77 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-the-value-attribute-with-radio-buttons-and-checkboxes.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-the-value-attribute-with-radio-buttons-and-checkboxes.md
@@ -5,9 +5,9 @@ challengeType: 0
forumTopicId: 301099
---
-## Description
-
-When a form gets submitted, the data is sent to the server and includes entries for the options selected. Inputs of type radio and checkbox report their values from the value attribute.
+# --description--
+
+When a form gets submitted, the data is sent to the server and includes entries for the options selected. Inputs of type `radio` and `checkbox` report their values from the `value` attribute.
For example:
@@ -20,40 +20,67 @@ For example:
```
+Here, you have two `radio` inputs. When the user submits the form with the `indoor` option selected, the form data will include the line: `indoor-outdoor=indoor`. This is from the `name` and `value` attributes of the "indoor" input.
-Here, you have two radio inputs. When the user submits the form with the indoor option selected, the form data will include the line: indoor-outdoor=indoor. This is from the name and value attributes of the "indoor" input.
+If you omit the `value` attribute, the submitted form data uses the default value, which is `on`. In this scenario, if the user clicked the "indoor" option and submitted the form, the resulting form data would be `indoor-outdoor=on`, which is not useful. So the `value` attribute needs to be set to something to identify the option.
-If you omit the value attribute, the submitted form data uses the default value, which is on. In this scenario, if the user clicked the "indoor" option and submitted the form, the resulting form data would be indoor-outdoor=on, which is not useful. So the value attribute needs to be set to something to identify the option.
-
+# --instructions--
-## Instructions
-
-Give each of the radio and checkbox inputs the value attribute. Use the input label text, in lowercase, as the value for the attribute.
-
+Give each of the `radio` and `checkbox` inputs the `value` attribute. Use the input label text, in lowercase, as the value for the attribute.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: One of your radio buttons should have the value attribute of indoor.
- testString: assert($('label:contains("Indoor") > input[type="radio"]').filter("[value='indoor']").length > 0);
- - text: One of your radio buttons should have the value attribute of outdoor.
- testString: assert($('label:contains("Outdoor") > input[type="radio"]').filter("[value='outdoor']").length > 0);
- - text: One of your checkboxes should have the value attribute of loving.
- testString: assert($('label:contains("Loving") > input[type="checkbox"]').filter("[value='loving']").length > 0);
- - text: One of your checkboxes should have the value attribute of lazy.
- testString: assert($('label:contains("Lazy") > input[type="checkbox"]').filter("[value='lazy']").length > 0);
- - text: One of your checkboxes should have the value attribute of energetic.
- testString: assert($('label:contains("Energetic") > input[type="checkbox"]').filter("[value='energetic']").length > 0);
+One of your radio buttons should have the `value` attribute of `indoor`.
+
+```js
+assert(
+ $('label:contains("Indoor") > input[type="radio"]').filter("[value='indoor']")
+ .length > 0
+);
```
-
+One of your radio buttons should have the `value` attribute of `outdoor`.
-## Challenge Seed
-
+```js
+assert(
+ $('label:contains("Outdoor") > input[type="radio"]').filter(
+ "[value='outdoor']"
+ ).length > 0
+);
+```
-
+One of your checkboxes should have the `value` attribute of `loving`.
+
+```js
+assert(
+ $('label:contains("Loving") > input[type="checkbox"]').filter(
+ "[value='loving']"
+ ).length > 0
+);
+```
+
+One of your checkboxes should have the `value` attribute of `lazy`.
+
+```js
+assert(
+ $('label:contains("Lazy") > input[type="checkbox"]').filter("[value='lazy']")
+ .length > 0
+);
+```
+
+One of your checkboxes should have the `value` attribute of `energetic`.
+
+```js
+assert(
+ $('label:contains("Energetic") > input[type="checkbox"]').filter(
+ "[value='energetic']"
+ ).length > 0
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
CatPhotoApp
@@ -86,14 +113,7 @@ tests:
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
CatPhotoApp
@@ -125,5 +145,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-001.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-001.md
index 52deb2d459..1d920208c2 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-001.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-001.md
@@ -4,49 +4,55 @@ title: Part 1
challengeType: 0
---
-## Description
-
+# --description--
HTML elements have opening tags like `
` and closing tags like `
`.
Find the `h1` element and change the text between its opening and closing tags to say `CatPhotoApp`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: The text `CatPhotoApp` should be present in the code. You may want to check your spelling.
- testString: assert( code.match(/catphotoapp/i) );
- - text: 'Your `h1` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelector('h1') );
- - text: Your `h1` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/h1\>/) );
- - text: You have more than one `h1` element. Remove the extra `h1` element.
- testString: assert( document.querySelectorAll('h1').length === 1 );
- - text: Your `h1` element's text should be `CatPhotoApp`. You have either omitted the text, have a typo, or it is not between the `h1` element's opening and closing tags.
- testString: assert( document.querySelector('h1').innerText.toLowerCase() === 'catphotoapp' );
+The text `CatPhotoApp` should be present in the code. You may want to check your spelling.
+```js
+assert(code.match(/catphotoapp/i));
```
-
+Your `h1` element should have an opening tag. Opening tags have this syntax: ``.
-## Challenge Seed
-
+```js
+assert(document.querySelector('h1'));
+```
-
+Your `h1` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/h1\>/));
+```
+
+You have more than one `h1` element. Remove the extra `h1` element.
+
+```js
+assert(document.querySelectorAll('h1').length === 1);
+```
+
+Your `h1` element's text should be `CatPhotoApp`. You have either omitted the text, have a typo, or it is not between the `h1` element's opening and closing tags.
+
+```js
+assert(document.querySelector('h1').innerText.toLowerCase() === 'catphotoapp');
+```
+
+# --seed--
+
+## --seed-contents--
```html
- --fcc-editable-region--
+--fcc-editable-region--
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-002.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-002.md
index 480cda0292..dee6278691 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-002.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-002.md
@@ -4,55 +4,78 @@ title: Part 2
challengeType: 0
---
-## Description
-
+# --description--
The `h1` to `h6` heading elements are used to signify the importance of content below them. The lower the number, the higher the importance, so `h2` elements have less importance than `h1` elements. Only use one `h1` element per page and place lower importance headings below higher importance headings.
Add an `h2` element below the `h1` element that says `Cat Photos`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'Your `h1` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelector('h1') );
- - text: Your `h1` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/h1\>/) );
- - text: You should only have one `h1` element. Remove the extra.
- testString: assert( document.querySelector('h1') && document.querySelectorAll('h1').length === 1 );
- - text: Your `h1` element's text should be 'CatPhotoApp'. You have either omitted the text or have a typo.
- testString: assert( document.querySelector('h1').innerText.toLowerCase() === 'catphotoapp' );
- - text: "Your `h2` element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelector('h2') );
- - text: Your `h2` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/h2\>/) );
- - text: Your `h2` element's text should be 'Cat Photos'. Only place the text `Cat Photos` between the opening and closing `h2` tags.
- testString: assert( document.querySelector('h2').innerText.toLowerCase() === 'cat photos' );
- - text: "Your `h2` element should be below the `h1` element. The `h1` element has greater importance and must be above the `h2` element."
- testString: const collection = [...document.querySelectorAll('h1,h2')].map(node => node.nodeName); assert( collection.indexOf('H1') < collection.indexOf('H2') );
+Your `h1` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelector('h1'));
```
-
+Your `h1` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/h1\>/));
+```
-
+You should only have one `h1` element. Remove the extra.
+
+```js
+assert(
+ document.querySelector('h1') && document.querySelectorAll('h1').length === 1
+);
+```
+
+Your `h1` element's text should be 'CatPhotoApp'. You have either omitted the text or have a typo.
+
+```js
+assert(document.querySelector('h1').innerText.toLowerCase() === 'catphotoapp');
+```
+
+Your `h2` element should have an opening tag. Opening tags have this syntax: ``.
+
+```js
+assert(document.querySelector('h2'));
+```
+
+Your `h2` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/h2\>/));
+```
+
+Your `h2` element's text should be 'Cat Photos'. Only place the text `Cat Photos` between the opening and closing `h2` tags.
+
+```js
+assert(document.querySelector('h2').innerText.toLowerCase() === 'cat photos');
+```
+
+Your `h2` element should be below the `h1` element. The `h1` element has greater importance and must be above the `h2` element.
+
+```js
+const collection = [...document.querySelectorAll('h1,h2')].map(
+ (node) => node.nodeName
+);
+assert(collection.indexOf('H1') < collection.indexOf('H2'));
+```
+
+# --seed--
+
+## --seed-contents--
```html
- --fcc-editable-region--
+--fcc-editable-region--
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-003.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-003.md
index 0834934540..58d3fa9995 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-003.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-003.md
@@ -4,48 +4,56 @@ title: Part 3
challengeType: 0
---
-## Description
-
+# --description--
-Paragraph (`p`) elements are used to create paragraph text on websites.
+Paragraph (`p`) elements are used to create paragraph text on websites.
Create a paragraph (`p`) element below your `h2` element, and give it the text `Click here to view more cat photos.`
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your `p` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( document.querySelector('p') );
- - text: Your `p` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/p\>/) );
- - text: Your `p` element's text should be `Click here to view more cat photos.` You have either omitted the text or have a typo.
- testString: const extraSpacesRemoved = document.querySelector('p').innerText.replace(/\s+/g, ' '); assert( extraSpacesRemoved.match(/click here to view more cat photos\.?$/i) );
- - text: Your `p` element should be below the `h2` element. You have them in the wrong order.
- testString: const collection = [...document.querySelectorAll('h2,p')].map(node => node.nodeName); assert( collection.indexOf('H2') < collection.indexOf('P') );
+Your `p` element should have an opening tag. Opening tags have the following syntax: ``.
+```js
+assert(document.querySelector('p'));
```
-
+Your `p` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/p\>/));
+```
-
+Your `p` element's text should be `Click here to view more cat photos.` You have either omitted the text or have a typo.
+
+```js
+const extraSpacesRemoved = document
+ .querySelector('p')
+ .innerText.replace(/\s+/g, ' ');
+assert(extraSpacesRemoved.match(/click here to view more cat photos\.?$/i));
+```
+
+Your `p` element should be below the `h2` element. You have them in the wrong order.
+
+```js
+const collection = [...document.querySelectorAll('h2,p')].map(
+ (node) => node.nodeName
+);
+assert(collection.indexOf('H2') < collection.indexOf('P'));
+```
+
+# --seed--
+
+## --seed-contents--
```html
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-004.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-004.md
index c4450731ef..1afc993425 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-004.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-004.md
@@ -4,53 +4,64 @@ title: Part 4
challengeType: 0
---
-## Description
-
+# --description--
Commenting allows you to leave messages without affecting the browser display. It also allows you to make code inactive. A comment in HTML starts with ``. For example, the comment `` contains the text `TODO: Remove h1`.
-Add a comment above the `p` element with the text `TODO: Add link to cat photos`. \
+Add a comment above the `p` element with the text `TODO: Add link to cat photos`. \\
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your comment should start with ``. You are missing one or more of the characters that define the end of a comment.
- testString: assert( code.match(/-->/) );
- - text: Your code should not have extra opening/closing comment characters. You have an extra `` displaying in the browser.
- testString: |
- const noSpaces = code.replace(/\s/g, '');
- assert (noSpaces.match(//g).length < 2 );
- - text: 'Your comment should contain the text `TODO: Add link to cat photos`.'
- testString: assert( code.match(//i) );
- - text: Your comment should be above the `p` element. You have them in the wrong order.
- testString: assert( code.replace(/\s/g, '').match(/
clickheretoviewmorecatphotos\.?<\/p>/i) );
+Your comment should start with ``. You are missing one or more of the characters that define the end of a comment.
-## Challenge Seed
-
+```js
+assert(code.match(/-->/));
+```
-
+Your code should not have extra opening/closing comment characters. You have an extra `` displaying in the browser.
+
+```js
+const noSpaces = code.replace(/\s/g, '');
+assert(noSpaces.match(//g).length < 2);
+```
+
+Your comment should contain the text `TODO: Add link to cat photos`.
+
+```js
+assert(code.match(//i));
+```
+
+Your comment should be above the `p` element. You have them in the wrong order.
+
+```js
+assert(
+ code
+ .replace(/\s/g, '')
+ .match(
+ /
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-005.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-005.md
index ce94beaaa4..07494c3215 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-005.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-005.md
@@ -4,52 +4,69 @@ title: Part 5
challengeType: 0
---
-## Description
-
+# --description--
HTML5 has some elements that identify different content areas. These elements make your HTML easier to read and help with Search Engine Optimization (SEO) and accessibility.
Identify the main section of this page by adding a `` opening tag after the `h1` element, and a `` closing tag after the `p` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your `main` element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelector('main') );
- - text: Your `main` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/main\>/) );
- - text: Your `main` element's opening tag should be below the `h1` element. You have them in the wrong order.
- testString: const collection = [...document.querySelectorAll('main,h1')].map(node => node.nodeName); assert( collection.indexOf('H1') < collection.indexOf('MAIN') );
- - text: Your `main` element's opening tag should be above the `h2` element. You have them in the wrong order.
- testString: const collection = [...document.querySelectorAll('main,h2')].map(node => node.nodeName); assert( collection.indexOf('MAIN') < collection.indexOf('H2') );
- - text: Your `main` element's closing tag should be below the `p` element. You have them in the wrong order.
- testString: const mainNode = document.querySelector('main'); const pNode = document.querySelector('p'); assert( mainNode.contains(pNode) && pNode.textContent.toLowerCase().match(/click here to view more cat photos/) );
+Your `main` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelector('main'));
```
-
+Your `main` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/main\>/));
+```
-
+Your `main` element's opening tag should be below the `h1` element. You have them in the wrong order.
+
+```js
+const collection = [...document.querySelectorAll('main,h1')].map(
+ (node) => node.nodeName
+);
+assert(collection.indexOf('H1') < collection.indexOf('MAIN'));
+```
+
+Your `main` element's opening tag should be above the `h2` element. You have them in the wrong order.
+
+```js
+const collection = [...document.querySelectorAll('main,h2')].map(
+ (node) => node.nodeName
+);
+assert(collection.indexOf('MAIN') < collection.indexOf('H2'));
+```
+
+Your `main` element's closing tag should be below the `p` element. You have them in the wrong order.
+
+```js
+const mainNode = document.querySelector('main');
+const pNode = document.querySelector('p');
+assert(
+ mainNode.contains(pNode) &&
+ pNode.textContent.toLowerCase().match(/click here to view more cat photos/)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
- --fcc-editable-region--
+--fcc-editable-region--
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-006.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-006.md
index 3db372c37e..cccf7c803e 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-006.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-006.md
@@ -4,60 +4,91 @@ title: Part 6
challengeType: 0
---
-## Description
-
+# --description--
HTML elements are often nested within other HTML elements. In the previous step you nested the `h2` element, comment and `p` element within the `main` element. A nested element is a child of its parent element.
To make HTML easier to read, indent the `h2` element, the comment, and `p` element exactly two spaces to indicate they are children of the `main` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your should have an `h2` element with text `Cat Photos`. You may have accidentally deleted it, it is missing both opening and closing tags, or the text has changed.
- testString: assert( document.querySelector('h2') && code.match(/<\/h2\>/) && document.querySelector('h2').innerText.toLowerCase() === 'cat photos' );
- - text: Your `h2` element should below the `main` element's opening tag and its opening tag should start 6 spaces over from the start of the line.
- testString: assert( code.toLowerCase().match(/\n\s{6}
/) );
- - text: Your code should have a comment. You removed the comment from an earlier step.
- testString: assert( code.match(//) );
- - text: "The comment's text should be `TODO: Add link to cat photos`. Do not change the text or spacing of the comment."
- testString: 'assert( code.match(//i) );'
- - text: Your comment should be below the `h2` element and start 6 spaces over from the start of the line.
- testString: 'assert( code.toLowerCase().match(/<\/h2>\n\s{6}/) );'
- - text: Your code should have a `p` element. You have removed the `p` element from an earlier step.
- testString: assert( document.querySelector('p') );
- - text: The text of the `p` element should be `Click here to view more cat photos.` Do not change the text, spacing, or punctuation of the `p` element.
- testString: assert( document.querySelector('p').innerText.toLowerCase().match(/click\s+here\s+to\s+view\s+more\s+cat\s+photos\.?$/) );
- - text: Your `p` element should be below the comment and its opening tag should start 6 spaces over from the start of the line.
- testString: assert( code.toLowerCase().match(/-->\n\s{6}
/) );
+Your should have an `h2` element with text `Cat Photos`. You may have accidentally deleted it, it is missing both opening and closing tags, or the text has changed.
+```js
+assert(
+ document.querySelector('h2') &&
+ code.match(/<\/h2\>/) &&
+ document.querySelector('h2').innerText.toLowerCase() === 'cat photos'
+);
```
-
+Your `h2` element should below the `main` element's opening tag and its opening tag should start 6 spaces over from the start of the line.
-## Challenge Seed
-
+```js
+assert(code.toLowerCase().match(/\n\s{6}
/));
+```
-
+Your code should have a comment. You removed the comment from an earlier step.
+
+```js
+assert(code.match(//));
+```
+
+The comment's text should be `TODO: Add link to cat photos`. Do not change the text or spacing of the comment.
+
+```js
+assert(code.match(//i));
+```
+
+Your comment should be below the `h2` element and start 6 spaces over from the start of the line.
+
+```js
+assert(
+ code
+ .toLowerCase()
+ .match(/<\/h2>\n\s{6}/)
+);
+```
+
+Your code should have a `p` element. You have removed the `p` element from an earlier step.
+
+```js
+assert(document.querySelector('p'));
+```
+
+The text of the `p` element should be `Click here to view more cat photos.` Do not change the text, spacing, or punctuation of the `p` element.
+
+```js
+assert(
+ document
+ .querySelector('p')
+ .innerText.toLowerCase()
+ .match(/click\s+here\s+to\s+view\s+more\s+cat\s+photos\.?$/)
+);
+```
+
+Your `p` element should be below the comment and its opening tag should start 6 spaces over from the start of the line.
+
+```js
+assert(code.toLowerCase().match(/-->\n\s{6}
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-007.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-007.md
index ec2edc11a4..4f0fb2b12a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-007.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-007.md
@@ -4,37 +4,44 @@ title: Part 7
challengeType: 0
---
-## Description
-
+# --description--
-You can add images to your website by using the `img` element. `img` elements have an opening tag without a closing tag. A tag for an element without a closing tag is known as a self-closing tag.
+You can add images to your website by using the `img` element. `img` elements have an opening tag without a closing tag. A tag for an element without a closing tag is known as a self-closing tag.
Add an `img` element below the `p` element. At this point, no image will show up in the browser.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your `img` element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelector('img') );
- - text: Your `img` element should not have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( !code.match(/<\/img\>/) );
- - text: You should only have one `img` element. Remove any extras.
- testString: assert( document.querySelectorAll('img').length === 1 );
- - text: Your `img` element should be below the `p` element. You have them in the wrong order.
- testString: const collection = [...document.querySelectorAll('p,img')].map(node => node.nodeName); assert( collection.indexOf('P') < collection.indexOf('IMG') );
+Your `img` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelector('img'));
```
-
+Your `img` element should not have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
+```js
+assert(!code.match(/<\/img\>/));
+```
-
+You should only have one `img` element. Remove any extras.
+
+```js
+assert(document.querySelectorAll('img').length === 1);
+```
+
+Your `img` element should be below the `p` element. You have them in the wrong order.
+
+```js
+const collection = [...document.querySelectorAll('p,img')].map(
+ (node) => node.nodeName
+);
+assert(collection.indexOf('P') < collection.indexOf('IMG'));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -43,13 +50,11 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-008.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-008.md
index 5a7b5b00fd..42b2d3df82 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-008.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-008.md
@@ -4,37 +4,41 @@ title: Part 8
challengeType: 0
---
-## Description
-
+# --description--
HTML attributes are special words used inside the opening tag of an element to control the element's behavior. The `src` attribute in an `img` element specifies the image's URL (where the image is located). An example of an `img` element using an `src` attribute: ``.
Add an `src` attribute to the existing `img` element that is set to the following URL: `https://bit.ly/fcc-relaxing-cat`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your code should have an `img` element. You may have removed the `img` element or you have not surrounded the `src` attribute's value with quotes.
- testString: assert( document.querySelector('img') );
- - text: Your `img` element should have an `src` attribute. You have either omitted the attribute or have a typo. Make sure there is a space between the element name and the attribute name.
- testString: assert( document.querySelector('img').src );
- - text: Your `img` element's `src` attribute should be set to 'https://bit.ly/fcc-relaxing-cat'. You have either omitted the URL or have a typo. The case of the URL is important.
- testString: assert( document.querySelector('img').src === 'https://bit.ly/fcc-relaxing-cat' );
- - text: Although you have set the `img` element's `src` to the correct URL, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\
+Your `img` element should have an `src` attribute. You have either omitted the attribute or have a typo. Make sure there is a space between the element name and the attribute name.
-## Challenge Seed
-
+```js
+assert(document.querySelector('img').src);
+```
-
+Your `img` element's `src` attribute should be set to '`https://bit.ly/fcc-relaxing-cat`'. You have either omitted the URL or have a typo. The case of the URL is important.
+
+```js
+assert(document.querySelector('img').src === 'https://bit.ly/fcc-relaxing-cat');
+```
+
+Although you have set the `img` element's `src` to the correct URL, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\
@@ -44,13 +48,11 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-009.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-009.md
index fa8e1402c0..700d5bd701 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-009.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-009.md
@@ -4,36 +4,39 @@ title: Part 9
challengeType: 0
---
-## Description
-
+# --description--
-All `img` elements should have an `alt` attribute. The `alt` attribute's text is used for screen readers to improve accessibility and is displayed if the image fails to load. For example, `` has an `alt` attribute with the text `A cat`.
+All `img` elements should have an `alt` attribute. The `alt` attribute's text is used for screen readers to improve accessibility and is displayed if the image fails to load. For example, `` has an `alt` attribute with the text `A cat`.
Add an `alt` attribute to the `img` element with the text `A cute orange cat lying on its back`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
-
- - text: Your code should have an `img` element. You removed the `img` element from an earlier step.
- testString: assert( document.querySelector('img') );
- - text: Your `img` element does not have an `alt` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( document.querySelector('img').hasAttribute('alt') );
- - text: Your `img` element's `alt` attribute value is set to something other than 'A cute orange cat lying on its back'. Make sure the `alt` attribute's value is surrounded with quotation marks.
- testString: const altText = document.querySelector('img').alt.toLowerCase().replace(/\s+/g, ' '); assert( altText.match(/A cute orange cat lying on its back\.?$/i) );
+Your code should have an `img` element. You removed the `img` element from an earlier step.
+```js
+assert(document.querySelector('img'));
```
-
+Your `img` element does not have an `alt` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
-## Challenge Seed
-
+```js
+assert(document.querySelector('img').hasAttribute('alt'));
+```
-
+Your `img` element's `alt` attribute value is set to something other than 'A cute orange cat lying on its back'. Make sure the `alt` attribute's value is surrounded with quotation marks.
+
+```js
+const altText = document
+ .querySelector('img')
+ .alt.toLowerCase()
+ .replace(/\s+/g, ' ');
+assert(altText.match(/A cute orange cat lying on its back\.?$/i));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -43,13 +46,11 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-010.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-010.md
index bd8df61681..6a2cb636c9 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-010.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-010.md
@@ -4,41 +4,61 @@ title: Part 10
challengeType: 0
---
-## Description
-
+# --description--
-You can link to another page with the anchor (`a`) element. For example, would link to `freecodecamp.org`.
+You can link to another page with the anchor (`a`) element. For example, [](https://www.freecodecamp.org) would link to `freecodecamp.org`.
Add an anchor element after the paragraph that links to `https://freecatphotoapp.com`. At this point, the link won’t show up in the preview.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your anchor (`a`) element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelector('a') );
- - text: "Your anchor (`a`) element should have a closing tag. Closing tags have a `/` just after the `<` character."
- testString: assert( code.match(/<\/a\>/) );
- - text: "Your anchor (`a`) element should be below the `p` element. You have them in the wrong order."
- testString: const collection = [...document.querySelectorAll('a, p')].map(node => node.nodeName); assert( collection.indexOf('P') < collection.indexOf('A') );
- - text: Your anchor (`a`) element does not have an `href` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( document.querySelector('a').hasAttribute('href') );
- - text: "Your anchor (`a`) element should link to `https://freecatphotoapp.com`. You have either omitted the URL or have a typo."
- testString: assert( document.querySelector('a').getAttribute('href') === 'https://freecatphotoapp.com' );
- - text: Although you have set the anchor ('a') element's `href` attribute to the correct link, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\`.
+```js
+assert(document.querySelector('a'));
```
-
+Your anchor (`a`) element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/a\>/));
+```
-
+Your anchor (`a`) element should be below the `p` element. You have them in the wrong order.
+
+```js
+const collection = [...document.querySelectorAll('a, p')].map(
+ (node) => node.nodeName
+);
+assert(collection.indexOf('P') < collection.indexOf('A'));
+```
+
+Your anchor (`a`) element does not have an `href` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+
+```js
+assert(document.querySelector('a').hasAttribute('href'));
+```
+
+Your anchor (`a`) element should link to `https://freecatphotoapp.com`. You have either omitted the URL or have a typo.
+
+```js
+assert(
+ document.querySelector('a').getAttribute('href') ===
+ 'https://freecatphotoapp.com'
+);
+```
+
+Although you have set the anchor ('a') element's `href` attribute to the correct link, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(
+ !/\
@@ -47,14 +67,12 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-011.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-011.md
index f2022ce408..dae7a90c44 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-011.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-011.md
@@ -4,35 +4,38 @@ title: Part 11
challengeType: 0
---
-## Description
-
+# --description--
A link's text must be placed between the opening and closing tags of an anchor (`a`) element. For example, `click here to go to freeCodeCamp.org` is a link with the text `click here to go to freeCodeCamp.org`.
Add the anchor text `cat photos` to the anchor element. This will become the link's text.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your anchor (`a`) element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelector('a') );
- - text: "Your anchor (`a`) element should have a closing tag. Closing tags have a `/` just after the `<` character."
- testString: assert( code.match(/<\/a\>/) );
- - text: Your anchor (`a`) element's text should be `cat photos`. Make sure to put the link text between the anchor (`a`) element's opening tag and closing tag.
- testString: assert( document.querySelector('a').innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat photos' );
+Your anchor (`a`) element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelector('a'));
```
-
+Your anchor (`a`) element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/a\>/));
+```
-
+Your anchor (`a`) element's text should be `cat photos`. Make sure to put the link text between the anchor (`a`) element's opening tag and closing tag.
+
+```js
+assert(
+ document.querySelector('a').innerText.toLowerCase().replace(/\s+/g, ' ') ===
+ 'cat photos'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -42,14 +45,12 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-012.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-012.md
index f7ce57d3fa..1091553ab3 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-012.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-012.md
@@ -4,41 +4,47 @@ title: Part 12
challengeType: 0
---
-## Description
-
+# --description--
Turn the words `cat photos` located inside `p` element into a link by replacing the words with the anchor element added previously. The `p` element should show the same text in the browser, but the words `cat photos` should now be a link. There should only be one link showing in the app.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your code should only contain one anchor (`a`) element. Remove any extra anchor elements.
- testString: assert( document.querySelectorAll('a').length === 1 );
- - text: Your anchor (`a`) element should be nested within the `p` element.
- testString: assert( $('p > a').length);
- - text: The link's text should be `cat photos`. You have either omitted the text or have a typo.
- testString: const nestedAnchor = $('p > a')[0];
- assert(
- nestedAnchor.getAttribute('href') === 'https://freecatphotoapp.com' &&
- nestedAnchor.innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat photos'
- );
- - text: After nesting the anchor (`a`) element, the only `p` element content visible in the browser should be `Click here to view more cat photos.` Double check the text, spacing, or punctuation of both the `p` and nested anchor element.
- testString: |
- const pText = document.querySelector('p').innerText.toLowerCase().replace(/\s+/g, ' ');
- assert( pText.match(/click here to view more cat photos\.?$/) );
+Your code should only contain one anchor (`a`) element. Remove any extra anchor elements.
+```js
+assert(document.querySelectorAll('a').length === 1);
```
-
+Your anchor (`a`) element should be nested within the `p` element.
-## Challenge Seed
-
+```js
+assert($('p > a').length);
+```
-
+The link's text should be `cat photos`. You have either omitted the text or have a typo.
+
+```js
+const nestedAnchor = $('p > a')[0];
+assert(
+ nestedAnchor.getAttribute('href') === 'https://freecatphotoapp.com' &&
+ nestedAnchor.innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat photos'
+);
+```
+
+After nesting the anchor (`a`) element, the only `p` element content visible in the browser should be `Click here to view more cat photos.` Double check the text, spacing, or punctuation of both the `p` and nested anchor element.
+
+```js
+const pText = document
+ .querySelector('p')
+ .innerText.toLowerCase()
+ .replace(/\s+/g, ' ');
+assert(pText.match(/click here to view more cat photos\.?$/));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -47,15 +53,13 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-013.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-013.md
index aa125848e4..47e19c40a5 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-013.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-013.md
@@ -4,35 +4,37 @@ title: Part 13
challengeType: 0
---
-## Description
-
+# --description--
-Add a `target` attribute with the value `_blank` to the anchor (`a`) element's opening tag, so that the link opens in a new tab.
+Add a `target` attribute with the value `_blank` to the anchor (`a`) element's opening tag, so that the link opens in a new tab.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your `p` element should have a nested anchor (`a`) element with the text `cat photos`. You may have deleted it or have a typo.
- testString: |
- const anchor = $('p > a');
- assert(anchor.length && anchor[0].innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat photos');
- - text: Your anchor (`a`) element does not have a `target` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( document.querySelector('a').hasAttribute('target') );
- - text: The value of the `target` attribute should '_blank'. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( document.querySelector('a').getAttribute('target') === '_blank' );
+Your `p` element should have a nested anchor (`a`) element with the text `cat photos`. You may have deleted it or have a typo.
+```js
+const anchor = $('p > a');
+assert(
+ anchor.length &&
+ anchor[0].innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat photos'
+);
```
-
+Your anchor (`a`) element does not have a `target` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
-## Challenge Seed
-
+```js
+assert(document.querySelector('a').hasAttribute('target'));
+```
-
+The value of the `target` attribute should '\_blank'. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert(document.querySelector('a').getAttribute('target') === '_blank');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -41,14 +43,12 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-014.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-014.md
index 9b4d48eb31..9df671cc1a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-014.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-014.md
@@ -4,43 +4,70 @@ title: Part 14
challengeType: 0
---
-## Description
-
+# --description--
Turn the image into a link by surrounding it with necessary element tags. Use `https://freecatphotoapp.com` as the anchor's `href` attribute value.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You should have an `img` element with an `src` value of `https://bit.ly/fcc-relaxing-cat`. You may have accidentally deleted it.
- testString: assert( document.querySelector('img') && document.querySelector('img').getAttribute('src') === 'https://bit.ly/fcc-relaxing-cat' );
- - text: "Your anchor (`a`) element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelectorAll('a').length >= 2 );
- - text: You should only add one opening anchor (`a`) tag. Please remove any extras.
- testString: assert( document.querySelectorAll('a').length === 2 );
- - text: Your anchor (`a`) element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/a>/g).length >= 2 );
- - text: You should only add one closing anchor (`a`) tag. Please remove any extras.
- testString: assert( code.match(/<\/a>/g).length === 2 );
- - text: Your anchor (`a`) element does not have an `href` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( document.querySelector('a').hasAttribute('href') );
- - text: Your anchor (`a`) element should link to `https://freecatphotoapp.com`. You have either omitted the URL or have a typo.
- testString: assert( document.querySelectorAll('a')[1].getAttribute('href') === 'https://freecatphotoapp.com' );
- - text: Your `img` element should be nested within the anchor (`a`) element. The entire `img` element should be inside the opening and closing tags of the anchor (`a`) element.
- testString: assert( document.querySelector('img').parentNode.nodeName === "A" );
+You should have an `img` element with an `src` value of `https://bit.ly/fcc-relaxing-cat`. You may have accidentally deleted it.
+```js
+assert(
+ document.querySelector('img') &&
+ document.querySelector('img').getAttribute('src') ===
+ 'https://bit.ly/fcc-relaxing-cat'
+);
```
-
+Your anchor (`a`) element should have an opening tag. Opening tags have this syntax: ``.
-## Challenge Seed
-
+```js
+assert(document.querySelectorAll('a').length >= 2);
+```
-
+You should only add one opening anchor (`a`) tag. Please remove any extras.
+
+```js
+assert(document.querySelectorAll('a').length === 2);
+```
+
+Your anchor (`a`) element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/a>/g).length >= 2);
+```
+
+You should only add one closing anchor (`a`) tag. Please remove any extras.
+
+```js
+assert(code.match(/<\/a>/g).length === 2);
+```
+
+Your anchor (`a`) element does not have an `href` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+
+```js
+assert(document.querySelector('a').hasAttribute('href'));
+```
+
+Your anchor (`a`) element should link to `https://freecatphotoapp.com`. You have either omitted the URL or have a typo.
+
+```js
+assert(
+ document.querySelectorAll('a')[1].getAttribute('href') ===
+ 'https://freecatphotoapp.com'
+);
+```
+
+Your `img` element should be nested within the anchor (`a`) element. The entire `img` element should be inside the opening and closing tags of the anchor (`a`) element.
+
+```js
+assert(document.querySelector('img').parentNode.nodeName === 'A');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -50,13 +77,11 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-015.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-015.md
index 1edfcca3c3..a96aa113fa 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-015.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-015.md
@@ -4,58 +4,59 @@ title: Part 15
challengeType: 0
---
-## Description
-
+# --description--
Before adding any new content, you should make use of a `section` element to separate the cat photos content from the future content.
Take all the elements currently located within the `main` element and nest them in a `section` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your `section` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( document.querySelector('section') );
- - text: Your `section` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/section\>/) );
- - text: The entire `section` element should be between the opening and closing tags of the `main` element.
- testString: assert( document.querySelector('section').parentNode.nodeName === "MAIN" );
- - text: The existing `h2`, comment, `p` element, and anchor (`a`) element should be between the opening and closing tags of the `section` element.
- testString: |
- const childrenOfSection = [ ...document.querySelector('section').childNodes ];
- const foundElems = childrenOfSection.filter(child => {
- return ['H2', 'A', 'P'].includes(child.nodeName);
- });
- assert( foundElems.length === 3 );
+Your `section` element should have an opening tag. Opening tags have the following syntax: ``.
+```js
+assert(document.querySelector('section'));
```
-
+Your `section` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/section\>/));
+```
-
+The entire `section` element should be between the opening and closing tags of the `main` element.
+
+```js
+assert(document.querySelector('section').parentNode.nodeName === 'MAIN');
+```
+
+The existing `h2`, comment, `p` element, and anchor (`a`) element should be between the opening and closing tags of the `section` element.
+
+```js
+const childrenOfSection = [...document.querySelector('section').childNodes];
+const foundElems = childrenOfSection.filter((child) => {
+ return ['H2', 'A', 'P'].includes(child.nodeName);
+});
+assert(foundElems.length === 3);
+```
+
+# --seed--
+
+## --seed-contents--
```html
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-016.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-016.md
index d22349b07f..fdf4aa27cb 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-016.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-016.md
@@ -4,67 +4,77 @@ title: Part 16
challengeType: 0
---
-## Description
-
+# --description--
It is time to add a new section. Add a second `section` element below the existing `section` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your `section` element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelectorAll('section').length >= 2 );
- - text: You should only add one opening `section` tag. Please remove any extras.
- testString: assert( document.querySelectorAll('section').length === 2 );
- - text: Your `section` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/section>/g).length >= 2 );
- - text: You should only add one closing `section` tag. Please remove any extras.
- testString: assert( code.match(/<\/section>/g).length === 2 );
- - text: The second `section` element should not be nested in the first `section` element.
- testString: |
- const childrenOf1stSection = [ ...document.querySelector('main > section').children ];
- const foundElems = childrenOf1stSection.filter(child => {
- return child.nodeName === 'SECTION';
- });
- assert( foundElems.length === 0 );
- - text: Both `section` elements should be between the opening and closing tags of the `main` element.
- testString: |
- const childrenOfMain = [ ...document.querySelector('main').children ];
- const foundElems = childrenOfMain.filter(child => {
- return child.nodeName === 'SECTION';
- });
- assert( foundElems.length === 2 );
+Your `section` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelectorAll('section').length >= 2);
```
-
+You should only add one opening `section` tag. Please remove any extras.
-## Challenge Seed
-
+```js
+assert(document.querySelectorAll('section').length === 2);
+```
-
+Your `section` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/section>/g).length >= 2);
+```
+
+You should only add one closing `section` tag. Please remove any extras.
+
+```js
+assert(code.match(/<\/section>/g).length === 2);
+```
+
+The second `section` element should not be nested in the first `section` element.
+
+```js
+const childrenOf1stSection = [
+ ...document.querySelector('main > section').children
+];
+const foundElems = childrenOf1stSection.filter((child) => {
+ return child.nodeName === 'SECTION';
+});
+assert(foundElems.length === 0);
+```
+
+Both `section` elements should be between the opening and closing tags of the `main` element.
+
+```js
+const childrenOfMain = [...document.querySelector('main').children];
+const foundElems = childrenOfMain.filter((child) => {
+ return child.nodeName === 'SECTION';
+});
+assert(foundElems.length === 2);
+```
+
+# --seed--
+
+## --seed-contents--
```html
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-017.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-017.md
index 4009c2abce..7439292c77 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-017.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-017.md
@@ -4,43 +4,53 @@ title: Part 17
challengeType: 0
---
-## Description
-
+# --description--
Within the second `section` element, add a new `h2` element with the text `Cat Lists`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your `section` element should have an opening tag. Opening tags have this syntax: ``."
- testString: |
- assert(
- document.querySelectorAll('section').length === 2 &&
- code.match(/<\/section>/g).length === 2
- );
- - text: "Your `h2` element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelectorAll('h2').length === 2 );
- - text: "Your `h2` element should have a closing tag. Closing tags have a `/` just after the `<` character."
- testString: assert( code.match(/<\/h2\>/g).length === 2 );
- - text: Your second `h2` element should be right above the second `section` element's closing tag. It is not in the correct position.
- testString: |
- const secondSection = document.querySelectorAll('section')[1];
- assert( secondSection.lastElementChild.nodeName === 'H2' );
- - text: The second `h2` element should have the text `Cat Lists`. You have either omitted the text or have a typo.
- testString: assert( document.querySelectorAll('main > section')[1].lastElementChild.innerText.toLowerCase() === 'cat lists');
+Your `section` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(
+ document.querySelectorAll('section').length === 2 &&
+ code.match(/<\/section>/g).length === 2
+);
```
-
+Your `h2` element should have an opening tag. Opening tags have this syntax: ``.
-## Challenge Seed
-
+```js
+assert(document.querySelectorAll('h2').length === 2);
+```
-
+Your `h2` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/h2\>/g).length === 2);
+```
+
+Your second `h2` element should be right above the second `section` element's closing tag. It is not in the correct position.
+
+```js
+const secondSection = document.querySelectorAll('section')[1];
+assert(secondSection.lastElementChild.nodeName === 'H2');
+```
+
+The second `h2` element should have the text `Cat Lists`. You have either omitted the text or have a typo.
+
+```js
+assert(
+ document
+ .querySelectorAll('main > section')[1]
+ .lastElementChild.innerText.toLowerCase() === 'cat lists'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -53,14 +63,12 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-018.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-018.md
index c643f1c65c..0a53b41a47 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-018.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-018.md
@@ -4,41 +4,59 @@ title: Part 18
challengeType: 0
---
-## Description
-
+# --description--
When you add a lower rank heading element to the page, it's implied that you're starting a new subsection.
After the last `h2` element of the second `section` element, add an `h3` element with the text `Things cats love:`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: The second `section` element appears to be missing or does not have both an opening and closing tag.
- testString: assert( (document.querySelectorAll('main > section')[1] && code.match(/\<\/section>/g).length == 2) );
- - text: There should be an `h3` element right above the second `section` element's closing tag.
- testString: assert( document.querySelectorAll('main > section')[1].lastElementChild.nodeName === 'H3' );
- - text: The `h3` element right above the second `section` element's closing tag should have the text `Things cats love:`. Make sure to include the colon at the end of the text.
- testString: assert( document.querySelectorAll('main > section')[1].lastElementChild.innerText.toLowerCase().replace(/\s+/g, ' ') === 'things cats love:' );
- - text: There should be an `h2` element with the text `Cat Lists` above the last `h3` element that is nested in the last `section` element'. You may have accidentally deleted the `h2` element.
- testString: |
- const secondSectionLastElemNode = document.querySelectorAll('main > section')[1].lastElementChild;
- assert(
- secondSectionLastElemNode.nodeName === 'H3' && secondSectionLastElemNode.previousElementSibling.innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat lists'
- );
+The second `section` element appears to be missing or does not have both an opening and closing tag.
+```js
+assert(
+ document.querySelectorAll('main > section')[1] &&
+ code.match(/\<\/section>/g).length == 2
+);
```
-
+There should be an `h3` element right above the second `section` element's closing tag.
-## Challenge Seed
-
+```js
+assert(
+ document.querySelectorAll('main > section')[1].lastElementChild.nodeName ===
+ 'H3'
+);
+```
-
+The `h3` element right above the second `section` element's closing tag should have the text `Things cats love:`. Make sure to include the colon at the end of the text.
+
+```js
+assert(
+ document
+ .querySelectorAll('main > section')[1]
+ .lastElementChild.innerText.toLowerCase()
+ .replace(/\s+/g, ' ') === 'things cats love:'
+);
+```
+
+There should be an `h2` element with the text `Cat Lists` above the last `h3` element that is nested in the last `section` element'. You may have accidentally deleted the `h2` element.
+
+```js
+const secondSectionLastElemNode = document.querySelectorAll('main > section')[1]
+ .lastElementChild;
+assert(
+ secondSectionLastElemNode.nodeName === 'H3' &&
+ secondSectionLastElemNode.previousElementSibling.innerText
+ .toLowerCase()
+ .replace(/\s+/g, ' ') === 'cat lists'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -51,15 +69,13 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-019.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-019.md
index add664064f..bd8e4edc5d 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-019.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-019.md
@@ -4,35 +4,34 @@ title: Part 19
challengeType: 0
---
-## Description
-
+# --description--
After the `h3` element with the `Things cats love:` text, add an unordered list (`ul`) element. Note that nothing will be displayed at this point.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'Your `ul` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelector('ul') );
- - text: Your `ul` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/ul>/) );
- - text: The `ul` element should be above the second `section` element's closing tag.
- testString: |
- const secondSectionLastElemNode = $('main > section')[1].lastElementChild;
- assert( secondSectionLastElemNode.nodeName === 'UL' );
+Your `ul` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelector('ul'));
```
-
+Your `ul` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/ul>/));
+```
-
+The `ul` element should be above the second `section` element's closing tag.
+
+```js
+const secondSectionLastElemNode = $('main > section')[1].lastElementChild;
+assert(secondSectionLastElemNode.nodeName === 'UL');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -46,15 +45,13 @@ tests:
- --fcc-editable-region--
+--fcc-editable-region--
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-020.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-020.md
index d7f3cc3f40..c19bfc9ccc 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-020.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-020.md
@@ -4,8 +4,7 @@ title: Part 20
challengeType: 0
---
-## Description
-
+# --description--
Use list item (`li`) elements to create items in a list. Here is an example of list items in an unordered list:
@@ -16,30 +15,40 @@ Use list item (`li`) elements to create items in a list. Here is an example of l
```
-Nest three list items within the `ul` element to display three things cats love: `cat nip`, `laser pointers` and `lasagna`.
+Nest three list items within the `ul` element to display three things cats love: `cat nip`, `laser pointers` and `lasagna`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You should have three `li` elements. Each `li` element should have its own opening and closing tag.
- testString: assert( $('li').length === 3 && code.match(/<\/li\>/g).length === 3 );
- - text: You should have three `li` elements with the text `cat nip`, `laser pointers` and `lasagna` in any order. You have either omitted some text or have a typo.
- testString: assert.deepStrictEqual( [ ...document.querySelectorAll('li') ].map(item => item.innerText.toLowerCase()).sort((a, b) => a.localeCompare(b)), ["cat nip", "lasagna", "laser pointers"] );
- - text: The three `li` elements should be located between the `ul` element's opening and closing tags.
- testString: assert( [ ...document.querySelectorAll('li') ].filter(item => item.parentNode.nodeName === 'UL').length === 3 );
+You should have three `li` elements. Each `li` element should have its own opening and closing tag.
+```js
+assert($('li').length === 3 && code.match(/<\/li\>/g).length === 3);
```
-
+You should have three `li` elements with the text `cat nip`, `laser pointers` and `lasagna` in any order. You have either omitted some text or have a typo.
-## Challenge Seed
-
+```js
+assert.deepStrictEqual(
+ [...document.querySelectorAll('li')]
+ .map((item) => item.innerText.toLowerCase())
+ .sort((a, b) => a.localeCompare(b)),
+ ['cat nip', 'lasagna', 'laser pointers']
+);
+```
-
+The three `li` elements should be located between the `ul` element's opening and closing tags.
+
+```js
+assert(
+ [...document.querySelectorAll('li')].filter(
+ (item) => item.parentNode.nodeName === 'UL'
+ ).length === 3
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -55,15 +64,13 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-021.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-021.md
index fefc8dc73e..d2a6a85602 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-021.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-021.md
@@ -4,39 +4,59 @@ title: Part 21
challengeType: 0
---
-## Description
-
+# --description--
After the unordered list, add a new image with an `src` attribute value set to `https://bit.ly/fcc-lasagna` and an `alt` attribute value set to `A slice of lasagna on a plate.`
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: There should be an `img` element right above the second `section` element's closing tag.
- testString: assert( $('section')[1].lastElementChild.nodeName === 'IMG' );
- - text: The new image either does not have an `alt` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert($('section')[1].lastElementChild.hasAttribute('alt') );
- - text: The new image should have an `alt` value of `A slice of lasagna on a plate.` Make sure the `alt` attribute's value is surrounded with quotation marks.
- testString: assert( $('section')[1].lastElementChild.getAttribute('alt').replace(/\s+/g, ' ').match(/^A slice of lasagna on a plate\.?$/i) );
- - text: The new image does not have an `src` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert($('section')[1].lastElementChild.hasAttribute('src') );
- - text: The new image should have an `src` value of `https://bit.ly/fcc-lasagna`. Make sure the `src` attribute's value is surrounded with quotation marks.
- testString: assert( $('section')[1].lastElementChild.getAttribute('src') === 'https://bit.ly/fcc-lasagna');
- - text: Although you have set the new image's `src` to the correct URL, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\
+The new image either does not have an `alt` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
-## Challenge Seed
-
+```js
+assert($('section')[1].lastElementChild.hasAttribute('alt'));
+```
-
+The new image should have an `alt` value of `A slice of lasagna on a plate.` Make sure the `alt` attribute's value is surrounded with quotation marks.
+
+```js
+assert(
+ $('section')[1]
+ .lastElementChild.getAttribute('alt')
+ .replace(/\s+/g, ' ')
+ .match(/^A slice of lasagna on a plate\.?$/i)
+);
+```
+
+The new image does not have an `src` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+
+```js
+assert($('section')[1].lastElementChild.hasAttribute('src'));
+```
+
+The new image should have an `src` value of `https://bit.ly/fcc-lasagna`. Make sure the `src` attribute's value is surrounded with quotation marks.
+
+```js
+assert(
+ $('section')[1].lastElementChild.getAttribute('src') ===
+ 'https://bit.ly/fcc-lasagna'
+);
+```
+
+Although you have set the new image's `src` to the correct URL, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\
@@ -52,18 +72,16 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-022.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-022.md
index 09d2cb619d..ac10960780 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-022.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-022.md
@@ -4,35 +4,45 @@ title: Part 22
challengeType: 0
---
-## Description
-
+# --description--
The `figure` element represents self-contained content and will allow you to associate an image with a caption.
Nest the image you just added within a `figure` element.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: "Your `figure` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( document.querySelector('figure') );
- - text: Your `figure` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/figure\>/) );
- - text: There should be an `figure` element right above the second `section` element's closing tag.
- testString: assert( $('section')[1].lastElementChild.nodeName === 'FIGURE' );
- - text: The lasagna `img` element should be nested in the `figure` element.
- testString: assert( document.querySelector('figure > img') && document.querySelector('figure > img').getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-lasagna');
+Your `figure` element should have an opening tag. Opening tags have the following syntax: ``.
+
+```js
+assert(document.querySelector('figure'));
```
-
+Your `figure` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
+```js
+assert(code.match(/<\/figure\>/));
+```
-
+There should be an `figure` element right above the second `section` element's closing tag.
+
+```js
+assert($('section')[1].lastElementChild.nodeName === 'FIGURE');
+```
+
+The lasagna `img` element should be nested in the `figure` element.
+
+```js
+assert(
+ document.querySelector('figure > img') &&
+ document.querySelector('figure > img').getAttribute('src').toLowerCase() ===
+ 'https://bit.ly/fcc-lasagna'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -53,9 +63,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-023.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-023.md
index 816be80c7a..0e767a6958 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-023.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-023.md
@@ -4,42 +4,74 @@ title: Part 23
challengeType: 0
---
-## Description
-
+# --description--
A figure caption (`figcaption`) element is used to add a caption to describe the image contained withing the `figure` element. For example, `A cute cat` adds the caption `A cute cat`.
After the image nested in the `figure` element, add a `figcaption` element with the text `Cats love lasagna.`
-
+# --hints--
-## Tests
-
+The Lasagna `img` element should be nested in the `figure` element.
-```yml
-tests:
- - text: The Lasagna `img` element should be nested in the `figure` element.
- testString: assert( document.querySelector('figure > img') && document.querySelector('figure > img').getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-lasagna');
- - text: "Your `figcaption` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( document.querySelector('figcaption') );
- - text: Your `figcaption` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/figcaption\>/) );
- - text: The `figcaption` element should be nested in the `figure` element.
- testString: assert( document.querySelector('figure > figcaption') && document.querySelector('figure > figcaption'));
- - text: The lasagna `img` element should be nested in the `figure` element.
- testString: assert( document.querySelector('figure > img') && document.querySelector('figure > img').getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-lasagna');
- - text: The `figcaption` element nested in the `figure` element should be below the `img` element. You have them in the wrong order.
- testString: assert( document.querySelector('figcaption').previousElementSibling.nodeName === 'IMG');
- - text: Your `figcaption` element's text should be `Cats love lasagna.` You have either omitted the text or have a typo.
- testString: assert( document.querySelector('figcaption').innerText.match(/Cats love lasagna.?$/i) );
+```js
+assert(
+ document.querySelector('figure > img') &&
+ document.querySelector('figure > img').getAttribute('src').toLowerCase() ===
+ 'https://bit.ly/fcc-lasagna'
+);
```
-
+Your `figcaption` element should have an opening tag. Opening tags have the following syntax: ``.
-## Challenge Seed
-
+```js
+assert(document.querySelector('figcaption'));
+```
-
+Your `figcaption` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/figcaption\>/));
+```
+
+The `figcaption` element should be nested in the `figure` element.
+
+```js
+assert(
+ document.querySelector('figure > figcaption') &&
+ document.querySelector('figure > figcaption')
+);
+```
+
+The lasagna `img` element should be nested in the `figure` element.
+
+```js
+assert(
+ document.querySelector('figure > img') &&
+ document.querySelector('figure > img').getAttribute('src').toLowerCase() ===
+ 'https://bit.ly/fcc-lasagna'
+);
+```
+
+The `figcaption` element nested in the `figure` element should be below the `img` element. You have them in the wrong order.
+
+```js
+assert(
+ document.querySelector('figcaption').previousElementSibling.nodeName === 'IMG'
+);
+```
+
+Your `figcaption` element's text should be `Cats love lasagna.` You have either omitted the text or have a typo.
+
+```js
+assert(
+ document.querySelector('figcaption').innerText.match(/Cats love lasagna.?$/i)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -61,9 +93,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-024.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-024.md
index 4d5bf92198..e0ecad805f 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-024.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-024.md
@@ -4,36 +4,52 @@ title: Part 24
challengeType: 0
---
-## Description
-
+# --description--
Emphasize the word `love` in the `figcaption` element by wrapping it in an emphasis (`em`) element.
-
+# --hints--
-## Tests
-
+Your emphasis (`em`) element should have an opening tag. Opening tags have this syntax: ``.
-```yml
-tests:
- - text: 'Your emphasis (`em`) element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelector('em') );
- - text: Your emphasis (`em`) element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/em\>/) );
- - text: You have either deleted the `figcaption` element or it is missing an opening or closing tag.
- testString: assert( document.querySelector('figcaption') && code.match(/<\/figcaption\>/) );
- - text: Your emphasis (`em`) element should surround the text `love`. You have either omitted the text or have a typo.
- testString: assert( document.querySelector('figcaption > em').innerText.toLowerCase() === 'love' );
- - text: The `figcaption`'s text should be `Cats love lasagna`. Check for typos and that the necessary spaces are present around the `em` element's opening and closing tags.
- testString: assert( document.querySelector('figcaption').innerText.replace(/\s+/gi, ' ').match(/cats love lasagna\.?/i) );
-
+```js
+assert(document.querySelector('em'));
```
-
+Your emphasis (`em`) element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/em\>/));
+```
+
+You have either deleted the `figcaption` element or it is missing an opening or closing tag.
+
+```js
+assert(document.querySelector('figcaption') && code.match(/<\/figcaption\>/));
+```
+
+Your emphasis (`em`) element should surround the text `love`. You have either omitted the text or have a typo.
+
+```js
+assert(
+ document.querySelector('figcaption > em').innerText.toLowerCase() === 'love'
+);
+```
+
+The `figcaption`'s text should be `Cats love lasagna`. Check for typos and that the necessary spaces are present around the `em` element's opening and closing tags.
+
+```js
+assert(
+ document
+ .querySelector('figcaption')
+ .innerText.replace(/\s+/gi, ' ')
+ .match(/cats love lasagna\.?/i)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -56,9 +72,9 @@ tests:
- --fcc-editable-region--
+--fcc-editable-region--
Cats love lasagna.
- --fcc-editable-region--
+--fcc-editable-region--
@@ -66,5 +82,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-025.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-025.md
index 22a61f7572..9f279f221b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-025.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-025.md
@@ -4,36 +4,46 @@ title: Part 25
challengeType: 0
---
-## Description
-
+# --description--
After the `figure` element, add another `h3` element with the text `Top 3 things cats hate:`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: There should be an `h3` element right above the second `section` element's closing tag. Make it has an opening and closing tag.
- testString: assert( document.querySelectorAll('main > section')[1].lastElementChild.nodeName === 'H3' && code.match(/<\/h3\>/g).length === 2);
- - text: The new `h3` element should have the text `Top 3 things cats hate:`. Make sure to include the colon at the end of the text.
- testString: assert( document.querySelectorAll('main > section')[1].lastElementChild.innerText.toLowerCase().replace(/\s+/g, ' ') === 'top 3 things cats hate:' );
- - text: There should be a `figure` above the new `h3` element. You may have accidentally deleted the `figure` element.
- testString: |
- const secondSectionLastElemNode = document.querySelectorAll('main > section')[1].lastElementChild;
- assert(
- secondSectionLastElemNode.nodeName === 'H3' && secondSectionLastElemNode.previousElementSibling.nodeName === 'FIGURE'
- );
+There should be an `h3` element right above the second `section` element's closing tag. Make it has an opening and closing tag.
+```js
+assert(
+ document.querySelectorAll('main > section')[1].lastElementChild.nodeName ===
+ 'H3' && code.match(/<\/h3\>/g).length === 2
+);
```
-
+The new `h3` element should have the text `Top 3 things cats hate:`. Make sure to include the colon at the end of the text.
-## Challenge Seed
-
-
+```js
+assert(
+ document
+ .querySelectorAll('main > section')[1]
+ .lastElementChild.innerText.toLowerCase()
+ .replace(/\s+/g, ' ') === 'top 3 things cats hate:'
+);
+```
+
+There should be a `figure` above the new `h3` element. You may have accidentally deleted the `figure` element.
+
+```js
+const secondSectionLastElemNode = document.querySelectorAll('main > section')[1]
+ .lastElementChild;
+assert(
+ secondSectionLastElemNode.nodeName === 'H3' &&
+ secondSectionLastElemNode.previousElementSibling.nodeName === 'FIGURE'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -54,17 +64,15 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-026.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-026.md
index fcc2703451..f956cd49c8 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-026.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-026.md
@@ -4,38 +4,57 @@ title: Part 26
challengeType: 0
---
-## Description
-
+# --description--
The code for an ordered list (`ol`) is similar to an unordered list, but list items in an ordered list are numbered when displayed.
After the final second section' last `h3` element, add an ordered list with these three list items: `flea treatment`, `thunder` and `other cats`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'Your `ol` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelector('ol') );
- - text: Your `ol` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/ol>/) );
- - text: The `ol` element should be above the second `section` element's closing tag. You have them in the wrong order.
- testString: assert( $('main > section')[1].lastElementChild.nodeName === 'OL' );
- - text: The three `li` elements should be nested inside the `ol` element.
- testString: assert( [ ...document.querySelectorAll('li') ].filter(item => item.parentNode.nodeName === 'OL').length === 3);
- - text: You should have three `li` elements with the text `flea treatment`, `thunder` and `other cats` in any order.
- testString: assert.deepStrictEqual( [ ...document.querySelectorAll('li') ].filter(item => item.parentNode.nodeName === 'OL').map(item => item.innerText.toLowerCase()).sort((a, b) => a.localeCompare(b)), ["flea treatment", "other cats", "thunder"] );
+Your `ol` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelector('ol'));
```
-
+Your `ol` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/ol>/));
+```
+
+The `ol` element should be above the second `section` element's closing tag. You have them in the wrong order.
+
+```js
+assert($('main > section')[1].lastElementChild.nodeName === 'OL');
+```
+
+The three `li` elements should be nested inside the `ol` element.
+
+```js
+assert(
+ [...document.querySelectorAll('li')].filter(
+ (item) => item.parentNode.nodeName === 'OL'
+ ).length === 3
+);
+```
+
+You should have three `li` elements with the text `flea treatment`, `thunder` and `other cats` in any order.
+
+```js
+assert.deepStrictEqual(
+ [...document.querySelectorAll('li')]
+ .filter((item) => item.parentNode.nodeName === 'OL')
+ .map((item) => item.innerText.toLowerCase())
+ .sort((a, b) => a.localeCompare(b)),
+ ['flea treatment', 'other cats', 'thunder']
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -60,9 +79,9 @@ tests:
Cats love lasagna.
- --fcc-editable-region--
+--fcc-editable-region--
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-027.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-027.md
index 799ebec3fc..4c14d32474 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-027.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-027.md
@@ -4,32 +4,33 @@ title: Part 27
challengeType: 0
---
-## Description
-
+# --description--
After the ordered list, add another `figure` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'Your `figure` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelectorAll('figure').length === 2 );
- - text: Your `figure` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/figure>/g).length === 2 );
- - text: There should be a `figure` element right above the second `section` element's closing tag.
- testString: assert( $('main > section')[1].lastElementChild.nodeName === 'FIGURE' );
+Your `figure` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelectorAll('figure').length === 2);
```
-
+Your `figure` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/figure>/g).length === 2);
+```
+
+There should be a `figure` element right above the second `section` element's closing tag.
+
+```js
+assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -55,18 +56,16 @@ tests:
Cats love lasagna.
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-028.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-028.md
index bd2b2c85fb..a7070e77d5 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-028.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-028.md
@@ -4,40 +4,59 @@ title: Part 28
challengeType: 0
---
-## Description
-
+# --description--
Inside the `figure` element you just added, nest an `img` element with a `src` attribute set to `https://bit.ly/fcc-cats`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'Your second `figure` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelectorAll('figure').length === 2 );
- - text: Your second `figure` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/figure>/g).length === 2 );
- - text: There should be a second `figure` element right above the second `section` element's closing tag. You have them in the wrong order.
- testString: assert( $('main > section')[1].lastElementChild.nodeName === 'FIGURE' );
- - text: You should have a third `img` element nested in the `figure` element.
- testString: const catsImg = document.querySelectorAll('figure > img')[1]; assert( catsImg && catsImg.getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-cats');
- - text: The third image should have an `src` attribute set to `https://bit.ly/fcc-cats`.
- testString: |
- const catsImg = document.querySelectorAll('figure > img')[1];
- assert( catsImg && catsImg.getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-cats');
- - text: Although you have set the new image's `src` to the correct URL, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\`.
+```js
+assert(document.querySelectorAll('figure').length === 2);
```
-
+Your second `figure` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/figure>/g).length === 2);
+```
+
+There should be a second `figure` element right above the second `section` element's closing tag. You have them in the wrong order.
+
+```js
+assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE');
+```
+
+You should have a third `img` element nested in the `figure` element.
+
+```js
+const catsImg = document.querySelectorAll('figure > img')[1];
+assert(
+ catsImg &&
+ catsImg.getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-cats'
+);
+```
+
+The third image should have an `src` attribute set to `https://bit.ly/fcc-cats`.
+
+```js
+const catsImg = document.querySelectorAll('figure > img')[1];
+assert(
+ catsImg &&
+ catsImg.getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-cats'
+);
+```
+
+Although you have set the new image's `src` to the correct URL, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\
@@ -68,15 +87,13 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-029.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-029.md
index 17b06d9909..3ba8a745df 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-029.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-029.md
@@ -4,36 +4,55 @@ title: Part 29
challengeType: 0
---
-## Description
-
+# --description--
To improve accessibility of the image you just added, add an `alt` attribute with the text `Five cats looking around a field.`
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'Your `figure` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelectorAll('figure').length === 2 );
- - text: Your `ol` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/figure>/g).length === 2 );
- - text: There should be a `figure` element right above the last `section` element's closing tag.
- testString: assert( $('main > section')[1].lastElementChild.nodeName === 'FIGURE' );
- - text: The Cats `img` element should be nested in the `figure` element.
- testString: const catsImg = document.querySelectorAll('figure > img')[1]; assert( catsImg && catsImg.getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-cats');
- - text: The Cats `img` element should have an `alt` attribute with the value `Five cats looking around a field.`
- testString: const catsImg = document.querySelectorAll('figure > img')[1]; assert( catsImg.getAttribute('alt').replace(/\s+/g, ' ').match(/^Five cats looking around a field\.?$/i) );
+Your `figure` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelectorAll('figure').length === 2);
```
-
+Your `ol` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/figure>/g).length === 2);
+```
+
+There should be a `figure` element right above the last `section` element's closing tag.
+
+```js
+assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE');
+```
+
+The Cats `img` element should be nested in the `figure` element.
+
+```js
+const catsImg = document.querySelectorAll('figure > img')[1];
+assert(
+ catsImg &&
+ catsImg.getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-cats'
+);
+```
+
+The Cats `img` element should have an `alt` attribute with the value `Five cats looking around a field.`
+
+```js
+const catsImg = document.querySelectorAll('figure > img')[1];
+assert(
+ catsImg
+ .getAttribute('alt')
+ .replace(/\s+/g, ' ')
+ .match(/^Five cats looking around a field\.?$/i)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -65,9 +84,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-030.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-030.md
index 1c5ff7a9e4..08859758b6 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-030.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-030.md
@@ -4,44 +4,81 @@ title: Part 30
challengeType: 0
---
-## Description
-
+# --description--
After the last `img` element, add a `figcaption` element with the text `Cats hate other cats.`
-
+# --hints--
-## Tests
-
+Your `figcaption` element should have an opening tag. Opening tags have the following syntax: ``.
-```yml
-tests:
- - text: "Your `figcaption` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( document.querySelectorAll('figcaption').length === 2 );
- - text: Your `figcaption` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/figcaption\>/g).length === 2 );
- - text: There should be a `figure` element right above the second `section` element's closing tag.
- testString: assert( $('main > section')[1].lastElementChild.nodeName === 'FIGURE' );
- - text: The last `img` element should be nested in the `figure` element.
- testString: const catsImg = document.querySelectorAll('figure > img')[1]; assert( catsImg && catsImg.getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-cats');
- - text: "Your `figure` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( document.querySelectorAll('figure').length === 2 );
- - text: Your `figure` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/figure\>/g).length === 2 );
- - text: The `figcaption` element should be nested in the `figure` element.
- testString: assert( document.querySelectorAll('figure > figcaption').length === 2);
- - text: The `figcaption` element nested in the `figure` element should be below the `img` element. You have the `img` element and the `figcaption` element in the wrong order.
- testString: assert( document.querySelectorAll('figcaption')[1].previousElementSibling.nodeName === 'IMG');
- - text: The `figcaption` element should have the text `Cats hate other cats.` You have omitted a word or have a typo.
- testString: assert( document.querySelectorAll('figcaption')[1].innerText.toLowerCase().match(/Cats hate other cats\.?$/i));
-
+```js
+assert(document.querySelectorAll('figcaption').length === 2);
```
-
+Your `figcaption` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/figcaption\>/g).length === 2);
+```
+
+There should be a `figure` element right above the second `section` element's closing tag.
+
+```js
+assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE');
+```
+
+The last `img` element should be nested in the `figure` element.
+
+```js
+const catsImg = document.querySelectorAll('figure > img')[1];
+assert(
+ catsImg &&
+ catsImg.getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-cats'
+);
+```
+
+Your `figure` element should have an opening tag. Opening tags have the following syntax: ``.
+
+```js
+assert(document.querySelectorAll('figure').length === 2);
+```
+
+Your `figure` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/figure\>/g).length === 2);
+```
+
+The `figcaption` element should be nested in the `figure` element.
+
+```js
+assert(document.querySelectorAll('figure > figcaption').length === 2);
+```
+
+The `figcaption` element nested in the `figure` element should be below the `img` element. You have the `img` element and the `figcaption` element in the wrong order.
+
+```js
+assert(
+ document.querySelectorAll('figcaption')[1].previousElementSibling.nodeName ===
+ 'IMG'
+);
+```
+
+The `figcaption` element should have the text `Cats hate other cats.` You have omitted a word or have a typo.
+
+```js
+assert(
+ document
+ .querySelectorAll('figcaption')[1]
+ .innerText.toLowerCase()
+ .match(/Cats hate other cats\.?$/i)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -73,9 +110,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-031.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-031.md
index fa419c3ceb..6d5d8f8e74 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-031.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-031.md
@@ -4,36 +4,53 @@ title: Part 31
challengeType: 0
---
-## Description
-
+# --description--
The `strong` element is used to indicate that some text is of strong importance or urgent.
In the `figcaption` you just added, indicate that `hate` is of strong importance by wrapping it in a `strong` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'Your `strong` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelector('strong') );
- - text: Your strong element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/strong\>/) );
- - text: Your strong element should surround the word `hate` in the text `Cats hate other cats.` You have either omitted the text or have a typo.
- testString: assert( document.querySelectorAll('figcaption')[1].querySelector('strong').innerText.toLowerCase() === 'hate' );
- - text: The `figcaption`'s text should be `Cats hate other cats.` Check for typos and that the necessary spaces are present around the `strong` element's opening and closing tags.
- testString: const secondFigCaption = document.querySelectorAll('figcaption')[1]; assert( secondFigCaption && secondFigCaption.innerText.replace(/\s+/gi, ' ').trim().match(/cats hate other cats\.?/i) );
+Your `strong` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelector('strong'));
```
-
+Your strong element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/strong\>/));
+```
+
+Your strong element should surround the word `hate` in the text `Cats hate other cats.` You have either omitted the text or have a typo.
+
+```js
+assert(
+ document
+ .querySelectorAll('figcaption')[1]
+ .querySelector('strong')
+ .innerText.toLowerCase() === 'hate'
+);
+```
+
+The `figcaption`'s text should be `Cats hate other cats.` Check for typos and that the necessary spaces are present around the `strong` element's opening and closing tags.
+
+```js
+const secondFigCaption = document.querySelectorAll('figcaption')[1];
+assert(
+ secondFigCaption &&
+ secondFigCaption.innerText
+ .replace(/\s+/gi, ' ')
+ .trim()
+ .match(/cats hate other cats\.?/i)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -66,9 +83,9 @@ tests:
- --fcc-editable-region--
+--fcc-editable-region--
Cats hate other cats.
- --fcc-editable-region--
+--fcc-editable-region--
@@ -76,5 +93,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-032.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-032.md
index d5f4c9dd06..7b096cb678 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-032.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-032.md
@@ -4,43 +4,55 @@ title: Part 32
challengeType: 0
---
-## Description
-
+# --description--
It is time to add a new section. Add a third `section` element below the second `section` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your `section` element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelectorAll('section').length >= 3 );
- - text: You should only add one opening `section` tag. Please remove any extras.
- testString: assert( document.querySelectorAll('section').length === 3 );
- - text: Your `section` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/section>/g).length >= 3 );
- - text: You should only add one closing `section` tag. Please remove any extras.
- testString: assert( code.match(/<\/section>/g).length === 3 );
- - text: All of the `section` elements should be between the opening and closing tags of the `main` element.
- testString: |
- const childrenOfMain = [ ...document.querySelector('main').children ];
- const sectionElemsFound = childrenOfMain.filter(child => {
- return child.nodeName === 'SECTION';
- });
- assert( sectionElemsFound.length === 3 );
- - text: The last `section` element should have no content. Remove any HTML elements or text within the `section` element.
- testString: assert( $('main > section')[2].children.length === 0 );
+Your `section` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelectorAll('section').length >= 3);
```
-
+You should only add one opening `section` tag. Please remove any extras.
-## Challenge Seed
-
-
+```js
+assert(document.querySelectorAll('section').length === 3);
+```
+
+Your `section` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/section>/g).length >= 3);
+```
+
+You should only add one closing `section` tag. Please remove any extras.
+
+```js
+assert(code.match(/<\/section>/g).length === 3);
+```
+
+All of the `section` elements should be between the opening and closing tags of the `main` element.
+
+```js
+const childrenOfMain = [...document.querySelector('main').children];
+const sectionElemsFound = childrenOfMain.filter((child) => {
+ return child.nodeName === 'SECTION';
+});
+assert(sectionElemsFound.length === 3);
+```
+
+The last `section` element should have no content. Remove any HTML elements or text within the `section` element.
+
+```js
+assert($('main > section')[2].children.length === 0);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -53,7 +65,7 @@ tests:
@@ -77,11 +89,9 @@ tests:
Cats hate other cats.
- --fcc-editable-region--
+--fcc-editable-region--
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-033.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-033.md
index fb52929ab0..67799dc420 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-033.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-033.md
@@ -4,48 +4,58 @@ title: Part 33
challengeType: 0
---
-## Description
-
+# --description--
Inside the third `section` element add an `h2` tag with the text `Cat Form`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Unable to find the third `section` element. You may have accidentally deleted it or the opening tag or closing tag."
- testString: |
- assert(
- document.querySelectorAll('section').length === 3 &&
- code.match(/<\/section>/g).length === 3
- );
- - text: Your `h2` element should have an opening tag and closing tag. You may be missing one or both of the required tags.
- testString: |
- assert(
- document.querySelectorAll('h2').length >= 3 &&
- code.match(/<\/h2>/g).length >= 3
- );
- - text: You should only add one `h2` element. Please remove any extras.
- testString: assert( document.querySelectorAll('h2').length === 3 );
- - text: The new `h2` element should be located right above the third `section` element's closing tag.
- testString: |
- const thirdSection = document.querySelectorAll('section')[2];
- assert( thirdSection.lastElementChild.nodeName === 'H2' );
- - text: Your `h2` element's text should be `Cat Form`.
- testString: |
- const thirdSection = document.querySelectorAll('section')[2];
- assert( thirdSection.querySelector('h2').innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat form' );
+Unable to find the third `section` element. You may have accidentally deleted it or the opening tag or closing tag.
+```js
+assert(
+ document.querySelectorAll('section').length === 3 &&
+ code.match(/<\/section>/g).length === 3
+);
```
-
+Your `h2` element should have an opening tag and closing tag. You may be missing one or both of the required tags.
-## Challenge Seed
-
-
+```js
+assert(
+ document.querySelectorAll('h2').length >= 3 &&
+ code.match(/<\/h2>/g).length >= 3
+);
+```
+
+You should only add one `h2` element. Please remove any extras.
+
+```js
+assert(document.querySelectorAll('h2').length === 3);
+```
+
+The new `h2` element should be located right above the third `section` element's closing tag.
+
+```js
+const thirdSection = document.querySelectorAll('section')[2];
+assert(thirdSection.lastElementChild.nodeName === 'H2');
+```
+
+Your `h2` element's text should be `Cat Form`.
+
+```js
+const thirdSection = document.querySelectorAll('section')[2];
+assert(
+ thirdSection
+ .querySelector('h2')
+ .innerText.toLowerCase()
+ .replace(/\s+/g, ' ') === 'cat form'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -81,14 +91,12 @@ tests:
Cats hate other cats.
- --fcc-editable-region--
+--fcc-editable-region--
- --fcc-editable-region--
+--fcc-editable-region--
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-034.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-034.md
index 75b05a2507..72eddb6e66 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-034.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-034.md
@@ -4,42 +4,42 @@ title: Part 34
challengeType: 0
---
-## Description
-
+# --description--
Now you will add a web form to collect information from users.
After the `Cat Form` heading, add a `form` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your `form` element should have an opening tag and closing tag. You may be missing one or both of the required tags, or have them in the wrong order.
- testString: |
- assert(
- document.querySelector('form') &&
- code.match(/<\/form>/g)
- );
- - text: Your `form` element tags are not in the correct order.
- testString: |
- const noSpaces = code.replace(/\s/g, '');
- assert( noSpaces.indexOf('') );
- - text: The `form` element nested in the last `section` element should be below the `h2` element. You have the `h2` element and the `form` element in the wrong order.
- testString: assert( document.querySelector('form').previousElementSibling.nodeName === 'H2');
- - text: The `form` element should have no content. Remove any HTML elements or text between the `form` element's tags.
- testString: assert( $('form')[0].innerHTML.trim().length === 0 );
+Your `form` element should have an opening tag and closing tag. You may be missing one or both of the required tags, or have them in the wrong order.
+```js
+assert(document.querySelector('form') && code.match(/<\/form>/g));
```
-
+Your `form` element tags are not in the correct order.
-## Challenge Seed
-
-
+```js
+const noSpaces = code.replace(/\s/g, '');
+assert(noSpaces.indexOf(''));
+```
+
+The `form` element nested in the last `section` element should be below the `h2` element. You have the `h2` element and the `form` element in the wrong order.
+
+```js
+assert(document.querySelector('form').previousElementSibling.nodeName === 'H2');
+```
+
+The `form` element should have no content. Remove any HTML elements or text between the `form` element's tags.
+
+```js
+assert($('form')[0].innerHTML.trim().length === 0);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -76,14 +76,12 @@ tests:
- --fcc-editable-region--
+--fcc-editable-region--
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-035.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-035.md
index 22643b2bda..23d9a062a7 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-035.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-035.md
@@ -4,46 +4,68 @@ title: Part 35
challengeType: 0
---
-## Description
-
+# --description--
The `action` attribute indicates where form data should be sent. For example, `` tells the browser that the form data should be sent to the path `/submit-url`.
Add an `action` attribute with the value `https://freecatphotoapp.com/submit-cat-photo` to the `form` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your `form` element should have an opening tag and closing tag in the correct order. You may be missing one or both of the required tags, or have them in the wrong order.
- testString: |
- const noSpaces = code.replace(/\s/g, '');
- assert(
- document.querySelector('form') &&
- code.match(/<\/form>/g) &&
- noSpaces.indexOf('
+Your `form` element nested in the last `section` element should be below the `h2` element. You have the `h2` element and the `form` element in the wrong order.
-## Challenge Seed
-
-
+```js
+assert(document.querySelector('form').previousElementSibling.nodeName === 'H2');
+```
+
+Your `form` element should have no content. Remove any HTML elements or text between the `form` element's tags.
+
+```js
+assert($('form')[0].innerHTML.trim().length === 0);
+```
+
+Your `form` element does not have an `action` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+
+```js
+const form = document.querySelector('form');
+assert(form.hasAttribute('action'));
+```
+
+Your `form` element should have an `action` attribute with the value `https://freecatphotoapp.com/submit-cat-photo`.
+
+```js
+const form = document.querySelector('form');
+assert(
+ form
+ .getAttribute('action')
+ .match(/^https:\/\/freecatphotoapp\.com\/submit-cat-photo$/)
+);
+```
+
+Although you have set the `action` attribute to the correct URL, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(
+ !/\
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-036.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-036.md
index 95b638dbd9..fe927d10c5 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-036.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-036.md
@@ -4,46 +4,61 @@ title: Part 36
challengeType: 0
---
-## Description
-
+# --description--
The `input` element is allows you several ways to collect data from a web form. Like anchor (`a`) elements, `input` elements are self-closing and do not need closing tags.
Nest an `input` element in the `form` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your `form` element should have an opening tag and closing tag in the correct order. You may be missing one or both of the required tags, or have them in the wrong order.
- testString: |
- const noSpaces = code.replace(/\s/g, '');
- assert(
- document.querySelector('form') &&
- code.match(/<\/form>/g) &&
- noSpaces.indexOf('
')
- );
- - text: Your `form` element's opening tag should only have an `action` attribute. Remove anything else you may have typed in it.
- testString: assert( [...document.querySelector('form').attributes].length < 2 );
- - text: You should create an input element. Check the syntax.
- testString: assert( document.querySelector('input') );
- - text: Your `input` element should have an opening tag, but not a closing tag.
- testString: assert( document.querySelector('input') && !code.match(/<\/input\>/g) );
- - text: Your `input` element should be nested within the `form` element.
- testString: assert( document.querySelector('form > input') );
- - text: Your `form` should only contain the `input` element. Remove any HTML elements or text between the `form` element's tags.
- testString: assert( $('form')[0].children.length === 1 && $('form')[0].innerText.trim().length === 0 );
+Your `form` element should have an opening tag and closing tag in the correct order. You may be missing one or both of the required tags, or have them in the wrong order.
+```js
+const noSpaces = code.replace(/\s/g, '');
+assert(
+ document.querySelector('form') &&
+ code.match(/<\/form>/g) &&
+ noSpaces.indexOf('
')
+);
```
-
+Your `form` element's opening tag should only have an `action` attribute. Remove anything else you may have typed in it.
-## Challenge Seed
-
-
+```js
+assert([...document.querySelector('form').attributes].length < 2);
+```
+
+You should create an input element. Check the syntax.
+
+```js
+assert(document.querySelector('input'));
+```
+
+Your `input` element should have an opening tag, but not a closing tag.
+
+```js
+assert(document.querySelector('input') && !code.match(/<\/input\>/g));
+```
+
+Your `input` element should be nested within the `form` element.
+
+```js
+assert(document.querySelector('form > input'));
+```
+
+Your `form` should only contain the `input` element. Remove any HTML elements or text between the `form` element's tags.
+
+```js
+assert(
+ $('form')[0].children.length === 1 &&
+ $('form')[0].innerText.trim().length === 0
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -81,15 +96,13 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-037.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-037.md
index 5bf365dd0b..281ee0a363 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-037.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-037.md
@@ -4,38 +4,55 @@ title: Part 37
challengeType: 0
---
-## Description
-
+# --description--
There are many kinds of inputs you can create using the `type` attribute. You can easily create a password field, reset button, or a control to let users select a file from their computer.
Create a text field to get text input from a user by adding the `type` attribute with the value `text` to the `input` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You have either deleted your `input` element or it has invalid syntax. If you have added an attributes, make sure their values are surrounded by quotation marks.
- testString: assert( $('input').length );
- - text: Your `form` element should only contain the `input` element. Remove any extra HTML elements or text between the `form` element's tags.
- testString: assert( $('form')[0].children.length === 1 && $('form')[0].innerText.trim().length === 0 );
- - text: Your `input` element does not have a `type` attribute. with the value `text`. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( $('input')[0].hasAttribute('type') );
- - text: Your `input` element should have a `type` attribute with the value `text`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( $('input')[0].getAttribute('type').replace(/\s+/g, ' ').match(/^text$/i) );
- - text: Although you have set the `input` element's `type` attribute to the `text`, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\
+Your `form` element should only contain the `input` element. Remove any extra HTML elements or text between the `form` element's tags.
-## Challenge Seed
-
-
+```js
+assert(
+ $('form')[0].children.length === 1 &&
+ $('form')[0].innerText.trim().length === 0
+);
+```
+
+Your `input` element does not have a `type` attribute. with the value `text`. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+
+```js
+assert($('input')[0].hasAttribute('type'));
+```
+
+Your `input` element should have a `type` attribute with the value `text`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert(
+ $('input')[0]
+ .getAttribute('type')
+ .replace(/\s+/g, ' ')
+ .match(/^text$/i)
+);
+```
+
+Although you have set the `input` element's `type` attribute to the `text`, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\
@@ -74,9 +91,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-038.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-038.md
index 4462a7f0a3..4e5d50df94 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-038.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-038.md
@@ -4,38 +4,54 @@ title: Part 38
challengeType: 0
---
-## Description
-
+# --description--
In order for a form's data to be accessed by the locaton specified in the `action` attribute, you must give the text field a `name` attribute and assign it a value to represent the data being submitted. For example, you could use the following syntax for an email address text field: ``.
-Add the `name` attribute with the value `catphoto ` to your text field.
+Add the `name` attribute with the value `catphoto` to your text field.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You have either deleted your `input` element or it has invalid syntax. All attributes' values should be surrounded by quotation marks.
- testString: assert( $('input').length );
- - text: Your `form` should only contain the `input` element. Remove any HTML additional elements or text within the `form` element.
- testString: assert( $('form')[0].children.length === 1 && $('form')[0].innerText.trim().length === 0 );
- - text: Your `input` element does not have a `name` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( $('input')[0].hasAttribute('name') );
- - text: Your `input` element should have a `name` attribute with the value `catphotourl`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( $('input')[0].getAttribute('name').match(/^catphotourl$/i) );
- - text: Although you have set the `input` element's `name` attribute to `catphotourl`, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\<\s*input\s+.*\s*=\s*catphotourl/.test(code) );
+You have either deleted your `input` element or it has invalid syntax. All attributes' values should be surrounded by quotation marks.
+```js
+assert($('input').length);
```
-
+Your `form` should only contain the `input` element. Remove any HTML additional elements or text within the `form` element.
-## Challenge Seed
-
-
+```js
+assert(
+ $('form')[0].children.length === 1 &&
+ $('form')[0].innerText.trim().length === 0
+);
+```
+
+Your `input` element does not have a `name` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+
+```js
+assert($('input')[0].hasAttribute('name'));
+```
+
+Your `input` element should have a `name` attribute with the value `catphotourl`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert(
+ $('input')[0]
+ .getAttribute('name')
+ .match(/^catphotourl$/i)
+);
+```
+
+Although you have set the `input` element's `name` attribute to `catphotourl`, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\<\s*input\s+.*\s*=\s*catphotourl/.test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -74,9 +90,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-039.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-039.md
index 93ff0a88bc..750f817f86 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-039.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-039.md
@@ -4,38 +4,55 @@ title: Part 39
challengeType: 0
---
-## Description
-
+# --description--
Placeholder text is used to give people a hint about what kind of information to enter into an input. For example, ``.
-Add the placeholder text `cat photo URL` to your `input` element.
+Add the placeholder text `cat photo URL` to your `input` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You have either deleted your `input` element or it has invalid syntax. All attributes' values should be surrounded by quotation marks.
- testString: assert( $('input').length );
- - text: Your `form` should only contain the `input` element. Remove any HTML additional elements or text within the `form` element.
- testString: assert( $('form')[0].children.length === 1 && $('form')[0].innerText.trim().length === 0 );
- - text: Your `input` element does not have a `placeholder` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( $('input')[0].hasAttribute('placeholder') );
- - text: Your `input` element should have a `placeholder` attribute with the value `cat photo URL`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( $('input')[0].getAttribute('placeholder').replace(/\s+/g, ' ').match(/^cat photo URL$/i) );
- - text: Although you have set the `input` element's `placeholder` attribute to `cat photo URL`, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\<\s*input\s+placeholder\s*=\s*cat\s+photo\s+url/i.test(code) );
+You have either deleted your `input` element or it has invalid syntax. All attributes' values should be surrounded by quotation marks.
+```js
+assert($('input').length);
```
-
+Your `form` should only contain the `input` element. Remove any HTML additional elements or text within the `form` element.
-## Challenge Seed
-
-
+```js
+assert(
+ $('form')[0].children.length === 1 &&
+ $('form')[0].innerText.trim().length === 0
+);
+```
+
+Your `input` element does not have a `placeholder` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+
+```js
+assert($('input')[0].hasAttribute('placeholder'));
+```
+
+Your `input` element should have a `placeholder` attribute with the value `cat photo URL`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert(
+ $('input')[0]
+ .getAttribute('placeholder')
+ .replace(/\s+/g, ' ')
+ .match(/^cat photo URL$/i)
+);
+```
+
+Although you have set the `input` element's `placeholder` attribute to `cat photo URL`, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\<\s*input\s+placeholder\s*=\s*cat\s+photo\s+url/i.test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -74,9 +91,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-040.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-040.md
index d74bdffb5c..8b0435052b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-040.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-040.md
@@ -4,34 +4,42 @@ title: Part 40
challengeType: 0
---
-## Description
-
+# --description--
To prevent a user from submitting your form when required information is missing, you need to add the `required` attribute to an `input` element. There's no need to set a value to the `required` attribute. Instead, just add the word `required` to the `input` element, making sure there is space between it and other attributes.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You have either deleted your `input` element or it has invalid syntax. All attributes' values should be surrounded by quotation marks.
- testString: assert( $('input').length );
- - text: Your `form` should only contain the `input` element. Remove any HTML additional elements or text within the `form` element.
- testString: assert( $('form')[0].children.length === 1 && $('form')[0].innerText.trim().length === 0 );
- - text: Your `input` element should have a `required` attribute. Remember, you just add the word `required` inside the `input` element's tag.
- testString: assert( $('input')[0].hasAttribute('required') );
- - text: A value should not be given to the `required` attribute.
- testString: assert( $('input')[0].getAttribute('required') === '' );
+You have either deleted your `input` element or it has invalid syntax. All attributes' values should be surrounded by quotation marks.
+```js
+assert($('input').length);
```
-
+Your `form` should only contain the `input` element. Remove any HTML additional elements or text within the `form` element.
-## Challenge Seed
-
-
+```js
+assert(
+ $('form')[0].children.length === 1 &&
+ $('form')[0].innerText.trim().length === 0
+);
+```
+
+Your `input` element should have a `required` attribute. Remember, you just add the word `required` inside the `input` element's tag.
+
+```js
+assert($('input')[0].hasAttribute('required'));
+```
+
+A value should not be given to the `required` attribute.
+
+```js
+assert($('input')[0].getAttribute('required') === '');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -70,9 +78,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-041.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-041.md
index 3e5f44da4e..18014cf8c9 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-041.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-041.md
@@ -4,36 +4,44 @@ title: Part 41
challengeType: 0
---
-## Description
-
+# --description--
Use the `button` element to create a clickable button. For example, `Click Here` creates a button with the text `Click Here`.
-Add a `button` element with the text `Submit` below the `input` element. Note the default behavior of clicking a form button with any attributes submits the form to the location specified in the form's `action` attribute.
+Add a `button` element with the text `Submit` below the `input` element. Note the default behavior of clicking a form button with any attributes submits the form to the location specified in the form's `action` attribute.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'Your `button` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelector('button') );
- - text: Your `button` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/button\>/) );
- - text: Your `button` element's text should be 'Submit'. You have either omitted the text or have a typo.
- testString: assert( document.querySelector('button').innerText.toLowerCase() === 'submit' );
- - text: Your `button` element should be below the `input` element. You have them in the wrong order.
- testString: const collection = [...document.querySelectorAll('input, button')].map(node => node.nodeName); assert( collection.indexOf('INPUT') < collection.indexOf('BUTTON') );
+Your `button` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelector('button'));
```
-
+Your `button` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/button\>/));
+```
+
+Your `button` element's text should be 'Submit'. You have either omitted the text or have a typo.
+
+```js
+assert(document.querySelector('button').innerText.toLowerCase() === 'submit');
+```
+
+Your `button` element should be below the `input` element. You have them in the wrong order.
+
+```js
+const collection = [...document.querySelectorAll('input, button')].map(
+ (node) => node.nodeName
+);
+assert(collection.indexOf('INPUT') < collection.indexOf('BUTTON'));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -72,9 +80,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-042.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-042.md
index 6121e6af41..c4b37e0bbf 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-042.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-042.md
@@ -4,38 +4,51 @@ title: Part 42
challengeType: 0
---
-## Description
-
+# --description--
Even through you added your button below the text input, they appear next to each other on the page. That's because both `input` and `button` elements are inline elements, which don't appear on new lines.
-You learned previously that the button submits the form by default, but you can explicitly add the `type` attribute with the value `submit` to it to make it clearer. Go ahead and do this to specify this button should submit the form.
+You learned previously that the button submits the form by default, but you can explicitly add the `type` attribute with the value `submit` to it to make it clearer. Go ahead and do this to specify this button should submit the form.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'Your `button` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelector('button') );
- - text: Your `button` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/button\>/) );
- - text: Your `button` element does not have a `type` attribute. Check that there is a space after the opening tag's name.
- testString: assert( $('button')[0].hasAttribute('type') );
- - text: Your `button` element should have a `type` attribute with the value `submit`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( $('button')[0].getAttribute('type').match(/^submit$/i) );
- - text: Although you have set the `button` element's `type` attribute to `submit`, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\<\s*button\s+type\s*=\s*submit/i.test(code) );
+Your `button` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelector('button'));
```
-
+Your `button` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/button\>/));
+```
+
+Your `button` element does not have a `type` attribute. Check that there is a space after the opening tag's name.
+
+```js
+assert($('button')[0].hasAttribute('type'));
+```
+
+Your `button` element should have a `type` attribute with the value `submit`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert(
+ $('button')[0]
+ .getAttribute('type')
+ .match(/^submit$/i)
+);
+```
+
+Although you have set the `button` element's `type` attribute to `submit`, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\<\s*button\s+type\s*=\s*submit/i.test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -75,9 +88,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-043.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-043.md
index 0e25897e52..c69c6c0aca 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-043.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-043.md
@@ -4,8 +4,7 @@ title: Part 43
challengeType: 0
---
-## Description
-
+# --description--
You can use radio buttons for questions where you want only one answer out of multiple options.
@@ -13,47 +12,77 @@ Here is an example of a radio button with the option of `cat`: ` input').length >= 2);
```
-
+Your `input` element should have an opening tag, but not a closing tag.
-## Challenge Seed
-
-
+```js
+assert($('form > input') && !code.match(/<\/input\>/g));
+```
+
+You should only have added one input element for your radio button. Remove any extras.
+
+```js
+assert($('form > input').length === 2);
+```
+
+Your new `input` element should be above the existing `input` with `type` attribute set to `text`. You have them in the wrong order.
+
+```js
+const existingInputElem = document.querySelector('form > input[type="text"]');
+assert(
+ existingInputElem &&
+ existingInputElem.previousElementSibling.nodeName === 'INPUT'
+);
+```
+
+Your new `input` element does not have a `type` attribute. Check that there is a space after the opening tag's name.
+
+```js
+assert($('input')[0].hasAttribute('type'));
+```
+
+Your new `input` element should have a `type` attribute with the value `radio`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert(
+ $('input')[0]
+ .getAttribute('type')
+ .match(/^radio$/i)
+);
+```
+
+Although you have set the new `input` element's `type` attribute to `radio`, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\<\s*input\s+type\s*=\s*radio/i.test(code));
+```
+
+The `radio` button's ` Indoor` text should be located after it instead of before it.
+
+```js
+const radioInputElem = $('input')[0];
+assert(!radioInputElem.previousSibling.nodeValue.match(/Indoor/i));
+```
+
+The text ` Indoor` should be located directly to the right of your `radio` button. Make sure there is a space between the element and the text. You have either omitted the text or have a typo.
+
+```js
+const radioInputElem = $('input')[0];
+assert(
+ radioInputElem.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Indoor/i)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -92,9 +121,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-044.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-044.md
index 8c46678e3e..b9ea51a1ef 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-044.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-044.md
@@ -4,42 +4,53 @@ title: Part 44
challengeType: 0
---
-## Description
-
+# --description--
`label` elements are used to help associate the text for an `input` element with the input element itself (especially for assistive technologies like screen readers). For example, ` cat` makes it so clicking the word `cat` also selects the corresponding radio button.
Nest your `radio` button inside a `label` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You should make sure the radio button is still present.
- testString: assert( $('input[type="radio"]')[0] );
- - text: The text ` Indoor` should be located directly to the right of your `radio` button. Make sure there is a space between the element and the text. You have either omitted the text or have a typo.
- testString: |
- const radioInputElem = $('input')[0];
- assert( radioInputElem.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Indoor/i) );
- - text: 'Your `label` element should have an opening tag. Opening tags have this syntax: ``.'
- testString: assert( document.querySelector('label') );
- - text: Your `label` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/label\>/) );
- - text: Your radio button and its text should all be located between the opening and closing tags of the `label` element.
- testString: |
- const labelChildNodes = [ ...$('form > label')[0].childNodes ];
- assert( labelChildNodes.filter(childNode => childNode.nodeName === "INPUT").length );
+You should make sure the radio button is still present.
+```js
+assert($('input[type="radio"]')[0]);
```
-
+The text ` Indoor` should be located directly to the right of your `radio` button. Make sure there is a space between the element and the text. You have either omitted the text or have a typo.
-## Challenge Seed
-
-
+```js
+const radioInputElem = $('input')[0];
+assert(
+ radioInputElem.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Indoor/i)
+);
+```
+
+Your `label` element should have an opening tag. Opening tags have this syntax: ``.
+
+```js
+assert(document.querySelector('label'));
+```
+
+Your `label` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/label\>/));
+```
+
+Your radio button and its text should all be located between the opening and closing tags of the `label` element.
+
+```js
+const labelChildNodes = [...$('form > label')[0].childNodes];
+assert(
+ labelChildNodes.filter((childNode) => childNode.nodeName === 'INPUT').length
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -78,9 +89,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-045.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-045.md
index 0caca5302d..a2889a0c99 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-045.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-045.md
@@ -4,36 +4,38 @@ title: Part 45
challengeType: 0
---
-## Description
-
+# --description--
The `id` attribute is used to identify specific HTML elements. Each `id` attribute's value must be unique all other `id` values for the entire page.
Add an `id` attribute with the value `indoor` to the radio button. When elements have multiple attributes, the order of the attributes doesn't matter.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your radio button should still be located between the opening and closing tags of the `label` element.
- testString: |
- const labelChildNodes = [ ...$('form > label')[0].childNodes ];
- assert( labelChildNodes.filter(childNode => childNode.nodeName === "INPUT").length );
- - text: Your radio button should have an `id` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( $('input')[0].hasAttribute('id') );
- - text: Your radio element should have an `id` attribute with the value `indoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( $('input')[0].id.match(/^indoor$/) );
+Your radio button should still be located between the opening and closing tags of the `label` element.
+```js
+const labelChildNodes = [...$('form > label')[0].childNodes];
+assert(
+ labelChildNodes.filter((childNode) => childNode.nodeName === 'INPUT').length
+);
```
-
+Your radio button should have an `id` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
-## Challenge Seed
-
-
+```js
+assert($('input')[0].hasAttribute('id'));
+```
+
+Your radio element should have an `id` attribute with the value `indoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert($('input')[0].id.match(/^indoor$/));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -72,9 +74,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-046.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-046.md
index 4d0cf0371f..29de338a9d 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-046.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-046.md
@@ -4,40 +4,56 @@ title: Part 46
challengeType: 0
---
-## Description
-
+# --description--
Nest a another radio button with the option `Outdoor` in a new `label` element. The new radio button should be placed after the first one. Also, set its `id` attribute value to `outdoor`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You will need to add a new `label` element in which to nest your new radio button. Make sure it has both an opening and closing tag.
- testString: assert( document.querySelectorAll('label').length === 2 && code.match(/<\/label\>/g).length === 2 );
- - text: The text ` Outdoor` should be located directly to the right of your new `radio` button. Make sure there is a space between the element and the text. You have either omitted the text or have a typo.
- testString: |
- const radioButtons = [ ...$('input')];
- assert( radioButtons.filter(btn => btn.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Outdoor/i)).length );
- - text: Your new radio button and associated label should be below the first one. You have them in the wrong order.
- testString: |
- const collection = [...document.querySelectorAll('input[type="radio"]')].map(node => node.nextSibling.nodeValue.replace(/\s+/g, ''));
- assert( collection.indexOf('Indoor') < collection.indexOf('Outdoor') );
- - text: Your new radio button should have an `id` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( $('input')[1].hasAttribute('id') );
- - text: Your new radio element should have an `id` attribute with the value `outdoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( $('input')[1].id.match(/^outdoor$/) );
+You will need to add a new `label` element in which to nest your new radio button. Make sure it has both an opening and closing tag.
+```js
+assert(
+ document.querySelectorAll('label').length === 2 &&
+ code.match(/<\/label\>/g).length === 2
+);
```
-
+The text ` Outdoor` should be located directly to the right of your new `radio` button. Make sure there is a space between the element and the text. You have either omitted the text or have a typo.
-## Challenge Seed
-
-
+```js
+const radioButtons = [...$('input')];
+assert(
+ radioButtons.filter((btn) =>
+ btn.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Outdoor/i)
+ ).length
+);
+```
+
+Your new radio button and associated label should be below the first one. You have them in the wrong order.
+
+```js
+const collection = [
+ ...document.querySelectorAll('input[type="radio"]')
+].map((node) => node.nextSibling.nodeValue.replace(/\s+/g, ''));
+assert(collection.indexOf('Indoor') < collection.indexOf('Outdoor'));
+```
+
+Your new radio button should have an `id` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+
+```js
+assert($('input')[1].hasAttribute('id'));
+```
+
+Your new radio element should have an `id` attribute with the value `outdoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert($('input')[1].id.match(/^outdoor$/));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -76,9 +92,9 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-047.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-047.md
index f6dc00edb1..ee3cab8230 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-047.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-047.md
@@ -4,40 +4,47 @@ title: Part 47
challengeType: 0
---
-## Description
-
+# --description--
-Notice that both radio buttons can be selected at the same time. To make it so selecting one radio button automatically deselects the other, both buttons must have a `name` attribute with the same value.
+Notice that both radio buttons can be selected at the same time. To make it so selecting one radio button automatically deselects the other, both buttons must have a `name` attribute with the same value.
Add the `name` attribute with the value `indoor-outdoor` to both radio buttons.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Both radio buttons should still be located between opening and closing `label` element tags.
- testString: |
- const labelChildNodes = [ ...document.querySelectorAll('form > label') ].map(node => node.childNodes);
- assert( labelChildNodes.filter(childNode => childNode[0].nodeName === "INPUT").length === 2 );
- - text: Both radio buttons should have a `name` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: |
- const radioButtons = [...document.querySelectorAll('input[type="radio"]')];
- assert( radioButtons.every(btn => btn.hasAttribute('name')) );
- - text: Both radio buttons should have a `name` attribute with the value `indoor-outdoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: |
- const radioButtons = [ ...$('input[type="radio"]') ];
- assert( radioButtons.every(btn => btn.getAttribute('name').match(/^indoor-outdoor$/)) );
+Both radio buttons should still be located between opening and closing `label` element tags.
+```js
+const labelChildNodes = [...document.querySelectorAll('form > label')].map(
+ (node) => node.childNodes
+);
+assert(
+ labelChildNodes.filter((childNode) => childNode[0].nodeName === 'INPUT')
+ .length === 2
+);
```
-
+Both radio buttons should have a `name` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
-## Challenge Seed
-
-
+```js
+const radioButtons = [...document.querySelectorAll('input[type="radio"]')];
+assert(radioButtons.every((btn) => btn.hasAttribute('name')));
+```
+
+Both radio buttons should have a `name` attribute with the value `indoor-outdoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+const radioButtons = [...$('input[type="radio"]')];
+assert(
+ radioButtons.every((btn) =>
+ btn.getAttribute('name').match(/^indoor-outdoor$/)
+ )
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -75,10 +82,10 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-048.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-048.md
index 722670fbe5..29cd8a88c2 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-048.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-048.md
@@ -4,44 +4,50 @@ title: Part 48
challengeType: 0
---
-## Description
-
+# --description--
If you select the `Indoor` radio button and submit the form, the form data for the button is based on its `name` and `value` attributes. Since your radio buttons do not have a `value` attribute, the form data will include `indoor-outdoor=on`, which is not useful when you have multiple buttons.
Add a `value` attribute to both radio buttons. For convenience, set the button's `value` attribute to the same value as its `id` attribute.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Both radio buttons should still be located between opening and closing `label` element tags.
- testString: |
- const labelChildNodes = [ ...document.querySelectorAll('form > label') ].map(node => node.childNodes);
- assert( labelChildNodes.filter(childNode => childNode[0].nodeName === "INPUT").length === 2 );
- - text: Both radio buttons should have a `value` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: |
- const radioButtons = [...document.querySelectorAll('input[type="radio"]')];
- assert( radioButtons.every(btn => btn.hasAttribute('value')) );
- - text: The `Indoor` radio button's `value` attribute should be set to `indoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: |
- const indoorRadioButton = document.querySelector('#indoor');
- assert( indoorRadioButton.getAttribute('value').match(/^indoor$/) );
- - text: The `Outdoor` radio button's `value` attribute should be set to `outdoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: |
- const outdoorRadioButton = document.querySelector('#outdoor');
- assert( outdoorRadioButton.getAttribute('value').match(/^outdoor$/) );
+Both radio buttons should still be located between opening and closing `label` element tags.
+```js
+const labelChildNodes = [...document.querySelectorAll('form > label')].map(
+ (node) => node.childNodes
+);
+assert(
+ labelChildNodes.filter((childNode) => childNode[0].nodeName === 'INPUT')
+ .length === 2
+);
```
-
+Both radio buttons should have a `value` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
-## Challenge Seed
-
-
+```js
+const radioButtons = [...document.querySelectorAll('input[type="radio"]')];
+assert(radioButtons.every((btn) => btn.hasAttribute('value')));
+```
+
+The `Indoor` radio button's `value` attribute should be set to `indoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+const indoorRadioButton = document.querySelector('#indoor');
+assert(indoorRadioButton.getAttribute('value').match(/^indoor$/));
+```
+
+The `Outdoor` radio button's `value` attribute should be set to `outdoor`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+const outdoorRadioButton = document.querySelector('#outdoor');
+assert(outdoorRadioButton.getAttribute('value').match(/^outdoor$/));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -79,10 +85,10 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-049.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-049.md
index 77df92f0ca..24b9368b83 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-049.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-049.md
@@ -4,40 +4,48 @@ title: Part 49
challengeType: 0
---
-## Description
-
+# --description--
The `fieldset` element is used to group related inputs and labels together in a web form. `fieldset` elements are block-level elements, meaning that they appear on a new line.
Nest the `Indoor` and `Outdoor` radio buttons within a `fieldset` element, and don't forget to indent the buttons.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Both radio buttons should still be located between opening and closing `label` element tags.
- testString: |
- const labelChildNodes = [ ...$('label') ].map(node => [ ...node.childNodes ]);
- assert( labelChildNodes.filter(childNode => childNode[0].nodeName === "INPUT").length === 2 );
- - text: "Your `fieldset` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( document.querySelector('fieldset') );
- - text: Your `fieldset` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/fieldset\>/) );
- - text: Both radio button and associated labels should be between the opening and closing tags of the `fieldset` element.
- testString: |
- const radioButtons = [ ...$('input[type="radio"]') ];
- assert( radioButtons.every(btn => btn.parentNode.parentNode.nodeName === "FIELDSET") );
+Both radio buttons should still be located between opening and closing `label` element tags.
+```js
+const labelChildNodes = [...$('label')].map((node) => [...node.childNodes]);
+assert(
+ labelChildNodes.filter((childNode) => childNode[0].nodeName === 'INPUT')
+ .length === 2
+);
```
-
+Your `fieldset` element should have an opening tag. Opening tags have the following syntax: ``.
-## Challenge Seed
-
-
+```js
+assert(document.querySelector('fieldset'));
+```
+
+Your `fieldset` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/fieldset\>/));
+```
+
+Both radio button and associated labels should be between the opening and closing tags of the `fieldset` element.
+
+```js
+const radioButtons = [...$('input[type="radio"]')];
+assert(
+ radioButtons.every((btn) => btn.parentNode.parentNode.nodeName === 'FIELDSET')
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -76,10 +84,10 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-050.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-050.md
index 4c909d33f9..b431a7c25b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-050.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-050.md
@@ -4,46 +4,51 @@ title: Part 50
challengeType: 0
---
-## Description
-
+# --description--
The `legend` element acts as a caption for the content in the `fieldset` element. It gives users context about what they should enter into that part of the form.
Add a `legend` element with the text `Is your cat an indoor or outdoor cat?` above both of the radio buttons.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your `legend` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( document.querySelector('legend') );
- - text: Your `legend` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/legend\>/) );
- - text: Your `legend` element should be the first element right below `fieldset` element's opening tag and before the first radio button's opening `label` tag. It is not in the correct position.
- testString: |
- const fieldsetElem = document.querySelector('fieldset');
- const fieldsetElemChildren = fieldsetElem.children;
- assert(
- fieldsetElem.firstElementChild.nodeName === 'LEGEND' &&
- fieldsetElemChildren[1].nodeName === 'LABEL' &&
- fieldsetElemChildren[1].children[0].nodeName === 'INPUT' &&
- fieldsetElemChildren[1].children[0].id === 'indoor'
- );
- - text: "Your `legend` element's text should be `Is your cat an indoor or outdoor cat?`. You have either omitted the text, have a typo, or it is not between the `legend` element's opening and closing tags."
- testString: |
- const extraSpacesRemoved = document.querySelector('legend').innerText.replace(/\s+/g, ' ');
- assert( extraSpacesRemoved.match(/Is your cat an indoor or outdoor cat\??$/i) );
+Your `legend` element should have an opening tag. Opening tags have the following syntax: ``.
+```js
+assert(document.querySelector('legend'));
```
-
+Your `legend` element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+assert(code.match(/<\/legend\>/));
+```
+
+Your `legend` element should be the first element right below `fieldset` element's opening tag and before the first radio button's opening `label` tag. It is not in the correct position.
+
+```js
+const fieldsetElem = document.querySelector('fieldset');
+const fieldsetElemChildren = fieldsetElem.children;
+assert(
+ fieldsetElem.firstElementChild.nodeName === 'LEGEND' &&
+ fieldsetElemChildren[1].nodeName === 'LABEL' &&
+ fieldsetElemChildren[1].children[0].nodeName === 'INPUT' &&
+ fieldsetElemChildren[1].children[0].id === 'indoor'
+);
+```
+
+Your `legend` element's text should be `Is your cat an indoor or outdoor cat?`. You have either omitted the text, have a typo, or it is not between the `legend` element's opening and closing tags.
+
+```js
+const extraSpacesRemoved = document
+ .querySelector('legend')
+ .innerText.replace(/\s+/g, ' ');
+assert(extraSpacesRemoved.match(/Is your cat an indoor or outdoor cat\??$/i));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -83,10 +88,10 @@ tests:
Cat Form
Submit
@@ -97,5 +102,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-051.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-051.md
index 63ce06f107..e650db871a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-051.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-051.md
@@ -4,55 +4,73 @@ title: Part 51
challengeType: 0
---
-## Description
-
+# --description--
Next, you are going to add some new form `input` elements, so add another `fieldset` element directly below the current `fieldset` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: "Your new `fieldset` element should have an opening tag. Opening tags have this syntax: ``."
- testString: assert( document.querySelectorAll('fieldset').length >= 2 );
- - text: You should only add one opening `fieldset` tag. Please remove any extras.
- testString: assert( document.querySelectorAll('fieldset').length === 2 );
- - text: Your new `fieldset` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/fieldset>/g).length >= 2 );
- - text: You should only add one closing `fieldset` tag. Please remove any extras.
- testString: assert( code.match(/<\/fieldset>/g).length === 2 );
- - text: The second `fieldset` element should not be nested in the first `fieldset` element.
- testString: |
- const childrenOf1stFieldset = [ ...document.querySelector('form > fieldset').children ];
- const foundElems = childrenOf1stFieldset.filter(child => {
- return child.nodeName === 'FIELDSET';
- });
- assert( foundElems.length === 0 );
- - text: Both `fieldset` elements should be above the text field and its associated `label` element. They are out of order.
- testString: |
- const formChildren = $('form')[0].children;
- assert(
- formChildren[0].nodeName === 'FIELDSET' &&
- formChildren[1].nodeName === 'FIELDSET' &&
- formChildren[2] && formChildren[2].nodeName === 'INPUT' &&
- formChildren[2].getAttribute('type') === 'text'
- );
- - text: Your new `fieldset` element should be below the existing `fieldset` element. You have them in the wrong order.
- testString: |
- const fieldsetChildren = [...document.querySelectorAll('fieldset')].map(elem => elem.children);
- assert( fieldsetChildren[0].length > fieldsetChildren
- [1].length );
+Your new `fieldset` element should have an opening tag. Opening tags have this syntax: ``.
+```js
+assert(document.querySelectorAll('fieldset').length >= 2);
```
-
+You should only add one opening `fieldset` tag. Please remove any extras.
-## Challenge Seed
-
-
+```js
+assert(document.querySelectorAll('fieldset').length === 2);
+```
+
+Your new `fieldset` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/fieldset>/g).length >= 2);
+```
+
+You should only add one closing `fieldset` tag. Please remove any extras.
+
+```js
+assert(code.match(/<\/fieldset>/g).length === 2);
+```
+
+The second `fieldset` element should not be nested in the first `fieldset` element.
+
+```js
+const childrenOf1stFieldset = [
+ ...document.querySelector('form > fieldset').children
+];
+const foundElems = childrenOf1stFieldset.filter((child) => {
+ return child.nodeName === 'FIELDSET';
+});
+assert(foundElems.length === 0);
+```
+
+Both `fieldset` elements should be above the text field and its associated `label` element. They are out of order.
+
+```js
+const formChildren = $('form')[0].children;
+assert(
+ formChildren[0].nodeName === 'FIELDSET' &&
+ formChildren[1].nodeName === 'FIELDSET' &&
+ formChildren[2] &&
+ formChildren[2].nodeName === 'INPUT' &&
+ formChildren[2].getAttribute('type') === 'text'
+);
+```
+
+Your new `fieldset` element should be below the existing `fieldset` element. You have them in the wrong order.
+
+```js
+const fieldsetChildren = [...document.querySelectorAll('fieldset')].map(
+ (elem) => elem.children
+);
+assert(fieldsetChildren[0].length > fieldsetChildren[1].length);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -91,7 +109,7 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-052.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-052.md
index 800a478db4..a4ba125d09 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-052.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-052.md
@@ -4,46 +4,57 @@ title: Part 52
challengeType: 0
---
-## Description
-
+# --description--
Add a `legend` element with the text `What's your cat's personality?` inside the second `fieldset` element.
-
+# --hints--
-## Tests
-
+You have either deleted the second `fieldset` element or it is missing an opening tag or closing tag."
-```yml
-tests:
- - text: You have either deleted the second `fieldset` element or it is missing an opening tag or closing tag."
- testString: |
- assert(
- document.querySelectorAll('fieldset').length === 2 &&
- code.match(/<\/fieldset>/g).length === 2
- );
- - text: "Your `legend` element should have an opening tag. Opening tags have this syntax: ``."
- testString: |
- const secondFieldset = $('fieldset')[1];
- assert( secondFieldset && [ ...secondFieldset.children ].filter(child => child.nodeName === 'LEGEND').length );
- - text: "Your `legend` element should have a closing tag. Closing tags have a `/` just after the `<` character."
- testString: assert( code.match(/<\/legend\>/g).length === 2 );
- - text: The `legend` element should have the text `What's your cat's personality?`. You have either omitted the text or have a typo.
- testString: |
- const secondFieldset = $('fieldset')[1];
- assert(
- secondFieldset && [ ...secondFieldset.children ].filter(child => {
- const extraSpacesRemoved = child.innerText.replace(/\s+/g, ' ');
- return child.nodeName === 'LEGEND' && extraSpacesRemoved.match(/What's your cat's personality\??$/i) ;
- }).length
- );
+```js
+assert(
+ document.querySelectorAll('fieldset').length === 2 &&
+ code.match(/<\/fieldset>/g).length === 2
+);
```
-
+Your `legend` element should have an opening tag. Opening tags have this syntax: ``.
-## Challenge Seed
-
-
+```js
+const secondFieldset = $('fieldset')[1];
+assert(
+ secondFieldset &&
+ [...secondFieldset.children].filter((child) => child.nodeName === 'LEGEND')
+ .length
+);
+```
+
+Your `legend` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/legend\>/g).length === 2);
+```
+
+The `legend` element should have the text `What's your cat's personality?`. You have either omitted the text or have a typo.
+
+```js
+const secondFieldset = $('fieldset')[1];
+assert(
+ secondFieldset &&
+ [...secondFieldset.children].filter((child) => {
+ const extraSpacesRemoved = child.innerText.replace(/\s+/g, ' ');
+ return (
+ child.nodeName === 'LEGEND' &&
+ extraSpacesRemoved.match(/What's your cat's personality\??$/i)
+ );
+ }).length
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -87,10 +98,10 @@ tests:
Indoor Outdoor
- --fcc-editable-region--
+--fcc-editable-region--
- --fcc-editable-region--
+--fcc-editable-region--
Submit
@@ -100,5 +111,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-053.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-053.md
index 086f5206f3..6aa2cca34b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-053.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-053.md
@@ -4,48 +4,70 @@ title: Part 53
challengeType: 0
---
-## Description
-
+# --description--
Forms commonly use checkboxes for questions that may have more than one answer. For example, here's a checkbox with the option of `tacos`: ` tacos`.
Under the `legend` element you just added, add an `input` with its `type` attribute set to `checkbox` and give it the option of `Loving`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: The `input` element for your checkbox should have an opening tag, but not a closing tag.
- testString: assert( $('fieldset > input') && !code.match(/<\/input\>/g) );
- - text: You should only have added one input element for your checkbox. Remove any extras.
- testString: assert( $('fieldset > input').length === 1 );
- - text: Your new `input` element should be below the `legend` element with the text `What's your cat's personality?`. You have them in the wrong order.
- testString: |
- const existingLegendElem = $('fieldset > legend')[1];
- assert(
- existingLegendElem && existingLegendElem.nextElementSibling.nodeName === 'INPUT'
- );
- - text: Your new `input` element does not have a `type` attribute. Check that there is a space after the opening tag's name.
- testString: assert( $('fieldset > input')[0].hasAttribute('type') );
- - text: Your new `input` element should have a `type` attribute with the value `checkbox`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( $('fieldset > input')[0].getAttribute('type').match(/^checkbox$/i) );
- - text: Although you have set the new `input` element's `type` attribute to `checkbox`, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\<\s*input\s+type\s*=\s*checkbox/i.test(code) );
- - text: The text ` Loving` should be located directly to the right of your checkbox. Make sure there is a space between the element and the text. You have either omitted the text or have a typo.
- testString: |
- const checkboxInputElem = $('input[type="checkbox"]')[0];
- assert( checkboxInputElem.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Loving/i) );
+The `input` element for your checkbox should have an opening tag, but not a closing tag.
+```js
+assert($('fieldset > input') && !code.match(/<\/input\>/g));
```
-
+You should only have added one input element for your checkbox. Remove any extras.
-## Challenge Seed
-
-
+```js
+assert($('fieldset > input').length === 1);
+```
+
+Your new `input` element should be below the `legend` element with the text `What's your cat's personality?`. You have them in the wrong order.
+
+```js
+const existingLegendElem = $('fieldset > legend')[1];
+assert(
+ existingLegendElem &&
+ existingLegendElem.nextElementSibling.nodeName === 'INPUT'
+);
+```
+
+Your new `input` element does not have a `type` attribute. Check that there is a space after the opening tag's name.
+
+```js
+assert($('fieldset > input')[0].hasAttribute('type'));
+```
+
+Your new `input` element should have a `type` attribute with the value `checkbox`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert(
+ $('fieldset > input')[0]
+ .getAttribute('type')
+ .match(/^checkbox$/i)
+);
+```
+
+Although you have set the new `input` element's `type` attribute to `checkbox`, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\<\s*input\s+type\s*=\s*checkbox/i.test(code));
+```
+
+The text ` Loving` should be located directly to the right of your checkbox. Make sure there is a space between the element and the text. You have either omitted the text or have a typo.
+
+```js
+const checkboxInputElem = $('input[type="checkbox"]')[0];
+assert(
+ checkboxInputElem.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Loving/i)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -90,9 +112,9 @@ tests:
OutdoorSubmit
@@ -103,5 +125,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-054.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-054.md
index 67c47889ba..24f644afa4 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-054.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-054.md
@@ -4,29 +4,27 @@ title: Part 54
challengeType: 0
---
-## Description
-
+# --description--
Add an `id` attribute with the value `loving` to the checkbox input.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your checkbox should have an `id` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: assert( $('input[type="checkbox"]')[0].hasAttribute('id') );
- - text: Your checkbox should have an `id` attribute with the value `loving`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( $('input[type="checkbox"]')[0].id.match(/^loving$/) );
+Your checkbox should have an `id` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+```js
+assert($('input[type="checkbox"]')[0].hasAttribute('id'));
```
-
+Your checkbox should have an `id` attribute with the value `loving`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
-## Challenge Seed
-
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-055.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-055.md
index 3192711ce4..7dc53c310e 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-055.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-055.md
@@ -4,54 +4,77 @@ title: Part 55
challengeType: 0
---
-## Description
-
+# --description--
There's another way to associate an `input` element's text with the element itself. You can nest the text within a `label` element and add a `for` attribute with the same value as the `input` element's `id` attribute.
Associate the text `Loving` with the checkbox by only nesting the text `Loving` in a `label` element and place it to the right side of the checkbox `input` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You should make sure the checkbox is still present.
- testString: assert( $('input[type="checkbox"]')[0] );
- - text: Your checkbox should still have an `id` attribute with the value `loving`. You may have removed the attribute or changed its value.
- testString: assert( $('input[type="checkbox"]')[0].id === 'loving' );
- - text: The text ` Loving` should no longer be located directly to the right of your checkbox. It should be wrapped in a `label` element.
- testString: |
- const checkboxInputElem = $('input[type="checkbox"]')[0];
- assert( !checkboxInputElem.nextSibling.nodeValue.replace(/\s+/g, ' ').match(/ Loving/i) );
- - text: You will need to add a new `label` element in which to nest the text `Loving`. Make sure it has both an opening and closing tag.
- testString: assert( document.querySelectorAll('label').length === 3 && code.match(/<\/label\>/g).length === 3 );
- - text: The new `label` element should be located directly to the right of your checkbox. Make sure there is a space between the two elements.
- testString: |
- const checkboxInputElem = $('input[type="checkbox"]')[0];
- assert( checkboxInputElem.nextElementSibling.nodeName === 'LABEL' );
- - text: The new `label` element does not have a `for` attribute. Check that there is a space after the opening tag's name.
- testString: |
- const labelElem = $('input[type="checkbox"]')[0].nextElementSibling;
- assert( labelElem.hasAttribute('for') );
- - text: The new `label` element should have a `for` attribute with the value `loving`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: |
- const labelElem = $('input[type="checkbox"]')[0].nextElementSibling;
- assert( labelElem.getAttribute('for').match(/^loving$/) );
- - text: The text `Loving` should be nested within the new `label` element. You have either omitted the text or have a typo.
- testString: |
- const labelElem = document.querySelector('label[for="loving"]');
- assert( labelElem.textContent.replace(/\s/g, '').match(/Loving/i) );
+You should make sure the checkbox is still present.
+```js
+assert($('input[type="checkbox"]')[0]);
```
-
+Your checkbox should still have an `id` attribute with the value `loving`. You may have removed the attribute or changed its value.
-## Challenge Seed
-
-
+```js
+assert($('input[type="checkbox"]')[0].id === 'loving');
+```
+
+The text ` Loving` should no longer be located directly to the right of your checkbox. It should be wrapped in a `label` element.
+
+```js
+const checkboxInputElem = $('input[type="checkbox"]')[0];
+assert(
+ !checkboxInputElem.nextSibling.nodeValue
+ .replace(/\s+/g, ' ')
+ .match(/ Loving/i)
+);
+```
+
+You will need to add a new `label` element in which to nest the text `Loving`. Make sure it has both an opening and closing tag.
+
+```js
+assert(
+ document.querySelectorAll('label').length === 3 &&
+ code.match(/<\/label\>/g).length === 3
+);
+```
+
+The new `label` element should be located directly to the right of your checkbox. Make sure there is a space between the two elements.
+
+```js
+const checkboxInputElem = $('input[type="checkbox"]')[0];
+assert(checkboxInputElem.nextElementSibling.nodeName === 'LABEL');
+```
+
+The new `label` element does not have a `for` attribute. Check that there is a space after the opening tag's name.
+
+```js
+const labelElem = $('input[type="checkbox"]')[0].nextElementSibling;
+assert(labelElem.hasAttribute('for'));
+```
+
+The new `label` element should have a `for` attribute with the value `loving`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+const labelElem = $('input[type="checkbox"]')[0].nextElementSibling;
+assert(labelElem.getAttribute('for').match(/^loving$/));
+```
+
+The text `Loving` should be nested within the new `label` element. You have either omitted the text or have a typo.
+
+```js
+const labelElem = document.querySelector('label[for="loving"]');
+assert(labelElem.textContent.replace(/\s/g, '').match(/Loving/i));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -97,9 +120,9 @@ tests:
Submit
@@ -110,5 +133,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-056.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-056.md
index 0f3e24421e..29205ec07a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-056.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-056.md
@@ -4,34 +4,39 @@ title: Part 56
challengeType: 0
---
-## Description
-
+# --description--
Add the `name` attribute with the value `personality` to the checkbox `input` element.
While you won't notice this in the browser, doing this makes it easier for a server to process your web form, especially when there are multiple checkboxes.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You should make sure the checkbox is still present.
- testString: assert( $('input[type="checkbox"]')[0] );
- - text: The checkbox `input` element does not have a `name` attribute. Check that there is a space after the opening tag's name.
- testString: assert( $('input[type="checkbox"]')[0].hasAttribute('name') );
- - text: The checkbox `input` element should have a `name` attribute with the value `personality`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: assert( $('input[type="checkbox"]')[0].getAttribute('name').match(/^personality$/) );
+You should make sure the checkbox is still present.
+```js
+assert($('input[type="checkbox"]')[0]);
```
-
+The checkbox `input` element does not have a `name` attribute. Check that there is a space after the opening tag's name.
-## Challenge Seed
-
-
+```js
+assert($('input[type="checkbox"]')[0].hasAttribute('name'));
+```
+
+The checkbox `input` element should have a `name` attribute with the value `personality`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+assert(
+ $('input[type="checkbox"]')[0]
+ .getAttribute('name')
+ .match(/^personality$/)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -77,9 +82,9 @@ tests:
Submit
@@ -90,5 +95,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-057.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-057.md
index 5959866803..3d88d090b3 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-057.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-057.md
@@ -4,44 +4,63 @@ title: Part 57
challengeType: 0
---
-## Description
-
+# --description--
Add another checkbox after the one you just added. The `id` attribute value should be `lazy` and the `name` attribute value should be the same as the last checkbox.
Also add a `label` element to the right of the new checkbox with the text `Lazy`. Make sure to associate the `label` element with the new checkbox using the `for` attribute.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You need to add a new checkbox.
- testString: assert( $('input[type="checkbox"]').length === 2 );
- - text: Your new checkbox should have an `id` attribute with the value `lazy` and a `name` attribute with the value `personality`. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: |
- const checkboxes = [ ...$('input[type="checkbox"]') ];
- assert( checkboxes.some(checkbox => checkbox.id === 'lazy' && checkbox.getAttribute('name') === 'personality') );
- - text: Your new checkbox should be after the first one. You have them in the wrong order.
- testString: |
- const checkboxes = [...$('input[type="checkbox"]')].map(checkbox => checkbox.id);
- assert( checkboxes.indexOf('loving') < checkboxes.indexOf('lazy') );
- - text: On the right side of your new checkbox, there should be `label` element with the text `Lazy`.
- testString: |
- const nextElementSibling = $('input[type="checkbox"]')[1].nextElementSibling;
- assert( nextElementSibling.nodeName === 'LABEL' && nextElementSibling.innerText.replace(/\s+/g, '').match(/^Lazy$/i) );
- - text: The new `label` should have a `for` attribute with the same value as the `id` attribute of the new checkbox. You have either omitted the value or have a typo.
- testString: assert( $('input[type="checkbox"]')[1].nextElementSibling.getAttribute('for') === 'lazy' );
+You need to add a new checkbox.
+```js
+assert($('input[type="checkbox"]').length === 2);
```
-
+Your new checkbox should have an `id` attribute with the value `lazy` and a `name` attribute with the value `personality`. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
-## Challenge Seed
-
-
+```js
+const checkboxes = [...$('input[type="checkbox"]')];
+assert(
+ checkboxes.some(
+ (checkbox) =>
+ checkbox.id === 'lazy' && checkbox.getAttribute('name') === 'personality'
+ )
+);
+```
+
+Your new checkbox should be after the first one. You have them in the wrong order.
+
+```js
+const checkboxes = [...$('input[type="checkbox"]')].map(
+ (checkbox) => checkbox.id
+);
+assert(checkboxes.indexOf('loving') < checkboxes.indexOf('lazy'));
+```
+
+On the right side of your new checkbox, there should be `label` element with the text `Lazy`.
+
+```js
+const nextElementSibling = $('input[type="checkbox"]')[1].nextElementSibling;
+assert(
+ nextElementSibling.nodeName === 'LABEL' &&
+ nextElementSibling.innerText.replace(/\s+/g, '').match(/^Lazy$/i)
+);
+```
+
+The new `label` should have a `for` attribute with the same value as the `id` attribute of the new checkbox. You have either omitted the value or have a typo.
+
+```js
+assert(
+ $('input[type="checkbox"]')[1].nextElementSibling.getAttribute('for') ===
+ 'lazy'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -87,9 +106,9 @@ tests:
Submit
@@ -100,5 +119,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-058.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-058.md
index ac53d2d6a1..8b81bbd1ae 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-058.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-058.md
@@ -4,44 +4,64 @@ title: Part 58
challengeType: 0
---
-## Description
-
+# --description--
Add a final checkbox after the previous one with an `id` attribute value of `energetic`. The `name` and attribute should be the same as the last checkbox.
Also add a `label` element to the right of the new checkbox with text `Energetic`. Make sure to associate the `label` element with the new checkbox.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You need to add a new checkbox.
- testString: assert( $('input[type="checkbox"]').length === 3 );
- - text: Your new checkbox should have an `id` attribute with the value `energetic` and a `name` attribute with the value `personality`. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: |
- const checkboxes = [ ...$('input[type="checkbox"]') ];
- assert( checkboxes.some(checkbox => checkbox.id === 'energetic' && checkbox.getAttribute('name') === 'personality') );
- - text: Your new checkbox should be after the first one. You have them in the wrong order.
- testString: |
- const checkboxes = [...$('input[type="checkbox"]')].map(checkbox => checkbox.id);
- assert( checkboxes.indexOf('lazy') < checkboxes.indexOf('energetic') );
- - text: On the right side of your new checkbox, there should be `label` element with the text `Energetic`.
- testString: |
- const nextElementSibling = $('input[type="checkbox"]')[2].nextElementSibling;
- assert( nextElementSibling.nodeName === 'LABEL' && nextElementSibling.innerText.replace(/\s+/g, '').match(/^Energetic$/i) );
- - text: The new `label` should have a `for` attribute with the same value as the `id` attribute of the new checkbox. You have either omitted the value or have a typo.
- testString: assert( $('input[type="checkbox"]')[2].nextElementSibling.getAttribute('for') === 'energetic' );
+You need to add a new checkbox.
+```js
+assert($('input[type="checkbox"]').length === 3);
```
-
+Your new checkbox should have an `id` attribute with the value `energetic` and a `name` attribute with the value `personality`. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
-## Challenge Seed
-
-
+```js
+const checkboxes = [...$('input[type="checkbox"]')];
+assert(
+ checkboxes.some(
+ (checkbox) =>
+ checkbox.id === 'energetic' &&
+ checkbox.getAttribute('name') === 'personality'
+ )
+);
+```
+
+Your new checkbox should be after the first one. You have them in the wrong order.
+
+```js
+const checkboxes = [...$('input[type="checkbox"]')].map(
+ (checkbox) => checkbox.id
+);
+assert(checkboxes.indexOf('lazy') < checkboxes.indexOf('energetic'));
+```
+
+On the right side of your new checkbox, there should be `label` element with the text `Energetic`.
+
+```js
+const nextElementSibling = $('input[type="checkbox"]')[2].nextElementSibling;
+assert(
+ nextElementSibling.nodeName === 'LABEL' &&
+ nextElementSibling.innerText.replace(/\s+/g, '').match(/^Energetic$/i)
+);
+```
+
+The new `label` should have a `for` attribute with the same value as the `id` attribute of the new checkbox. You have either omitted the value or have a typo.
+
+```js
+assert(
+ $('input[type="checkbox"]')[2].nextElementSibling.getAttribute('for') ===
+ 'energetic'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -87,10 +107,10 @@ tests:
Submit
@@ -101,5 +121,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-059.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-059.md
index 9b7b261df9..6b1b15bb3a 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-059.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-059.md
@@ -4,44 +4,45 @@ title: Part 59
challengeType: 0
---
-## Description
-
+# --description--
Like radio buttons, form data for selected checkboxes are `name` / `value` attribute pairs. While the `value` attribute is optional, it's best practice to include it with any checkboxes or radio buttons on the page.
Add a `value` attribute to each checkbox. For convenience, set each checkbox's `value` attribute to the same value as its `id` attribute.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: All three checkboxes should have a `value` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
- testString: |
- const checkboxes = [...document.querySelectorAll('input[type="checkbox"]')];
- assert( checkboxes.every(checkbox => checkbox.hasAttribute('value')) );
- - text: The `value` attribute of the `Loving` checkbox should be set to `loving`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: |
- const lovingCheckbox = document.querySelector('#loving');
- assert( lovingCheckbox.getAttribute('value').match(/^loving$/) );
- - text: The `value` attribute of the `Lazy` checkbox should be set to `lazy`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: |
- const lazyCheckbox = document.querySelector('#lazy');
- assert( lazyCheckbox.getAttribute('value').match(/^lazy$/) );
- - text: The `value` attribute of the `Energetic` checkbox should be set to `energetic`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
- testString: |
- const energeticCheckbox = document.querySelector('#energetic');
- assert( energeticCheckbox.getAttribute('value').match(/^energetic$/) );
+All three checkboxes should have a `value` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
+```js
+const checkboxes = [...document.querySelectorAll('input[type="checkbox"]')];
+assert(checkboxes.every((checkbox) => checkbox.hasAttribute('value')));
```
-
+The `value` attribute of the `Loving` checkbox should be set to `loving`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
-## Challenge Seed
-
-
+```js
+const lovingCheckbox = document.querySelector('#loving');
+assert(lovingCheckbox.getAttribute('value').match(/^loving$/));
+```
+
+The `value` attribute of the `Lazy` checkbox should be set to `lazy`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+const lazyCheckbox = document.querySelector('#lazy');
+assert(lazyCheckbox.getAttribute('value').match(/^lazy$/));
+```
+
+The `value` attribute of the `Energetic` checkbox should be set to `energetic`. You have either omitted the value or have a typo. Remember that attribute values should be surrounded with quotation marks.
+
+```js
+const energeticCheckbox = document.querySelector('#energetic');
+assert(energeticCheckbox.getAttribute('value').match(/^energetic$/));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -80,7 +81,7 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-060.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-060.md
index fd3b815c64..e71150fcfc 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-060.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-060.md
@@ -4,40 +4,56 @@ title: Part 60
challengeType: 0
---
-## Description
-
+# --description--
In order to make a checkbox checked or radio button selected by default, you need to add the `checked` attribute to it. There's no need to set a value to the `checked` attribute. Instead, just add the word `checked` to the `input` element, making sure there is space between it and other attributes.
Make the first radio button and the first checkbox selected by default.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Make sure there still are two radio buttons and three checkboxes nested in their respective `fieldset` elements.
- testString: assert( $('input[type="radio"]').length === 2 && $('fieldset > input[type="checkbox"]').length === 3 );
- - text: The first radio button is missing the `checked` attribute.
- testString: assert( $('input[type="radio"]')[0].hasAttribute('checked') );
- - text: The second radio button should not have the `checked` attribute.
- testString: assert( !$('input[type="radio"]')[1].hasAttribute('checked') );
- - text: The first checkbox is missing the `checked` attribute.
- testString: assert( $('input[type="checkbox"]')[0].hasAttribute('checked') );
- - text: The second checkbox should not have the `checked` attribute.
- testString: assert( !$('input[type="checkbox"]')[1].hasAttribute('checked') );
- - text: The third checkbox should not have the `checked` attribute.
- testString: assert( !$('input[type="checkbox"]')[2].hasAttribute('checked') );
+Make sure there still are two radio buttons and three checkboxes nested in their respective `fieldset` elements.
+```js
+assert(
+ $('input[type="radio"]').length === 2 &&
+ $('fieldset > input[type="checkbox"]').length === 3
+);
```
-
+The first radio button is missing the `checked` attribute.
-## Challenge Seed
-
-
+```js
+assert($('input[type="radio"]')[0].hasAttribute('checked'));
+```
+
+The second radio button should not have the `checked` attribute.
+
+```js
+assert(!$('input[type="radio"]')[1].hasAttribute('checked'));
+```
+
+The first checkbox is missing the `checked` attribute.
+
+```js
+assert($('input[type="checkbox"]')[0].hasAttribute('checked'));
+```
+
+The second checkbox should not have the `checked` attribute.
+
+```js
+assert(!$('input[type="checkbox"]')[1].hasAttribute('checked'));
+```
+
+The third checkbox should not have the `checked` attribute.
+
+```js
+assert(!$('input[type="checkbox"]')[2].hasAttribute('checked'));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -76,7 +92,7 @@ tests:
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-061.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-061.md
index b523017f18..6371d6fed6 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-061.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-061.md
@@ -4,36 +4,41 @@ title: Part 61
challengeType: 0
---
-## Description
-
+# --description--
-Now you will add a footer section to the page.
+Now you will add a footer section to the page.
After the `main` element, add a `footer` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You have either deleted the `main` element or it is missing an opening tag or closing tag."
- testString: assert( document.querySelector('main') && code.match(/<\/main>/) );
- - text: "Your `footer` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( document.querySelector('footer') );
- - text: Your `footer` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/<\/footer\>/) );
- - text: Your `footer` element should the below the closing `main` element tag. You have it put it somewhere else.
- testString: assert( document.querySelector('main').nextElementSibling.nodeName === 'FOOTER' );
+You have either deleted the `main` element or it is missing an opening tag or closing tag."
+```js
+assert(document.querySelector('main') && code.match(/<\/main>/));
```
-
+Your `footer` element should have an opening tag. Opening tags have the following syntax: ``.
-## Challenge Seed
-
-
+```js
+assert(document.querySelector('footer'));
+```
+
+Your `footer` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/<\/footer\>/));
+```
+
+Your `footer` element should the below the closing `main` element tag. You have it put it somewhere else.
+
+```js
+assert(document.querySelector('main').nextElementSibling.nodeName === 'FOOTER');
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -87,12 +92,10 @@ tests:
Submit
- --fcc-editable-region--
+--fcc-editable-region--
--fcc-editable-region--
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-062.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-062.md
index 47e129b7e8..322acfc817 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-062.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-062.md
@@ -4,37 +4,41 @@ title: Part 62
challengeType: 0
---
-## Description
-
+# --description--
Nest a `p` element with the text `No Copyright - freeCodeCamp.org` within the `footer` element.
-
+# --hints--
-## Tests
-
+You have either deleted the `footer` element or it is missing an opening tag or closing tag."
-```yml
-tests:
- - text: You have either deleted the `footer` element or it is missing an opening tag or closing tag."
- testString: assert( document.querySelector('footer') && code.match(/<\/footer>/) );
- - text: Your `footer` element should have a `p` element. Make sure to added an opening tag and closing tag for the `p` element.
- testString: assert( document.querySelector('footer > p') );
- - text: Your `footer` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: |
- const pElemClosingTags = code.match(/<\/p\>/g);
- assert( pElemClosingTags && pElemClosingTags.length === 2);
- - text: "Your `p` element's text should be `No Copyright - freeCodeCamp.org`. You have either omitted the text, have a typo, or it is not between the `legend` element's opening and closing tags."
- testString: |
- const extraSpacesRemoved = $('footer > p')[0].innerText.replace(/\s+/g, ' ');
- assert( extraSpacesRemoved.match(/No Copyright - freeCodeCamp\.org$/i) );
+```js
+assert(document.querySelector('footer') && code.match(/<\/footer>/));
```
-
+Your `footer` element should have a `p` element. Make sure to added an opening tag and closing tag for the `p` element.
-## Challenge Seed
-
-
+```js
+assert(document.querySelector('footer > p'));
+```
+
+Your `footer` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+const pElemClosingTags = code.match(/<\/p\>/g);
+assert(pElemClosingTags && pElemClosingTags.length === 2);
+```
+
+Your `p` element's text should be `No Copyright - freeCodeCamp.org`. You have either omitted the text, have a typo, or it is not between the `legend` element's opening and closing tags.
+
+```js
+const extraSpacesRemoved = $('footer > p')[0].innerText.replace(/\s+/g, ' ');
+assert(extraSpacesRemoved.match(/No Copyright - freeCodeCamp\.org$/i));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -89,13 +93,11 @@ tests:
- --fcc-editable-region--
+--fcc-editable-region--
- --fcc-editable-region--
+--fcc-editable-region--
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-063.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-063.md
index 54bc8ce92c..61703a22b2 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-063.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-063.md
@@ -4,44 +4,52 @@ title: Part 63
challengeType: 0
---
-## Description
-
+# --description--
Make the text `freeCodeCamp.org` into a link by enclosing it in an anchor (`a`) element. The `href` attribute should be set to `https://www.freecodecamp.org`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your anchor (`a`) element should be nested within the `footer` element. Make sure to added an opening tag and closing tag for the anchor (`a`) element.
- testString: assert( $('footer > p > a').length );
- - text: Your anchor (`a`) element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: |
- const aElemClosingTags = code.match(/<\/a\>/g);
- assert( aElemClosingTags && aElemClosingTags.length === 3);
- - text: Your anchor (`a`) element should have an `href` attribute with the value `https://www.freecodecamp.org`. You may have omitted the attribute/value, or have a typo.
- testString: |
- const nestedAnchor = $('footer > p > a')[0];
- assert( nestedAnchor.getAttribute('href') === 'https://www.freecodecamp.org' );
- - text: The link's text should be `freeCodeCamp.org`. You have either omitted the text or have a typo.
- testString: |
- const nestedAnchor = $('footer > p > a')[0];
- assert( nestedAnchor.innerText.toLowerCase().replace(/\s+/g, ' ') === 'freecodecamp.org');
- - text: After nesting the anchor (`a`) element, the only `p` element content visible in the browser should be `No Copyright - freeCodeCamp.org`. Double check the text, spacing, or punctuation of both the `p` and nested anchor element.
- testString: |
- const pText = $('footer > p')[0].innerText.toLowerCase().replace(/\s+/g, ' ');
- assert( pText.match(/^no copyright - freecodecamp.org$/) );
+Your anchor (`a`) element should be nested within the `footer` element. Make sure to added an opening tag and closing tag for the anchor (`a`) element.
+```js
+assert($('footer > p > a').length);
```
-
+Your anchor (`a`) element should have a closing tag. Closing tags have a `/` just after the `<` character.
-## Challenge Seed
-
-
+```js
+const aElemClosingTags = code.match(/<\/a\>/g);
+assert(aElemClosingTags && aElemClosingTags.length === 3);
+```
+
+Your anchor (`a`) element should have an `href` attribute with the value `https://www.freecodecamp.org`. You may have omitted the attribute/value, or have a typo.
+
+```js
+const nestedAnchor = $('footer > p > a')[0];
+assert(nestedAnchor.getAttribute('href') === 'https://www.freecodecamp.org');
+```
+
+The link's text should be `freeCodeCamp.org`. You have either omitted the text or have a typo.
+
+```js
+const nestedAnchor = $('footer > p > a')[0];
+assert(
+ nestedAnchor.innerText.toLowerCase().replace(/\s+/g, ' ') ===
+ 'freecodecamp.org'
+);
+```
+
+After nesting the anchor (`a`) element, the only `p` element content visible in the browser should be `No Copyright - freeCodeCamp.org`. Double check the text, spacing, or punctuation of both the `p` and nested anchor element.
+
+```js
+const pText = $('footer > p')[0].innerText.toLowerCase().replace(/\s+/g, ' ');
+assert(pText.match(/^no copyright - freecodecamp.org$/));
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -98,14 +106,12 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-064.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-064.md
index b42c328cb5..af337bef37 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-064.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-064.md
@@ -4,42 +4,46 @@ title: Part 64
challengeType: 0
---
-## Description
-
+# --description--
Notice that everything you've added to the page so far is inside the `body` element. All page content elements that should be rendered to the page go inside the `body` element. However, other important information goes inside the `head` element.
Add a `head` element just above the `body` element.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You have either deleted the `body` element or it is missing an opening tag or closing tag.
- testString: assert( document.querySelector('body') && code.match(/<\/body>/) );
- - text: "Your `head` element should have an opening tag. Opening tags have the following syntax: ``."
- testString: assert( code.match(/\/) );
- - text: Your `head` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: assert( code.match(/\<\/head\>/) );
- - text: Your `head` element should be above the opening `body` element tag. You have it put it somewhere else.
- testString: |
- const noSpaces = code.replace(/\s/g, '');
- assert( noSpaces.match(/\<\/head\>\/) );
+You have either deleted the `body` element or it is missing an opening tag or closing tag.
+```js
+assert(document.querySelector('body') && code.match(/<\/body>/));
```
-
+Your `head` element should have an opening tag. Opening tags have the following syntax: ``.
-## Challenge Seed
-
-
+```js
+assert(code.match(/\/));
+```
+
+Your `head` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/\<\/head\>/));
+```
+
+Your `head` element should be above the opening `body` element tag. You have it put it somewhere else.
+
+```js
+const noSpaces = code.replace(/\s/g, '');
+assert(noSpaces.match(/\<\/head\>\/));
+```
+
+# --seed--
+
+## --seed-contents--
```html
- --fcc-editable-region--
+--fcc-editable-region--
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-065.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-065.md
index 15a4866e8a..6ceee3dec0 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-065.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-065.md
@@ -4,46 +4,49 @@ title: Part 65
challengeType: 0
---
-## Description
-
+# --description--
The `title` element determines what browsers show in the title bar or tab for the page.
Add a `title` element within the `head` element. Its text should be `CatPhotoApp`.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You have either deleted the `head` element or it is missing an opening tag or closing tag.
- testString: assert( code.match(/\/) && code.match(/\<\/head\>/) );
- - text: Your `title` element should be nested in the `head` element. Make sure to added an opening tag and closing tag for the `title` element.
- testString: |
- const noSpaces = code.replace(/\s/g, '');
- assert( noSpaces.match(/\\.*\<\/title\>\<\/head\>/) );
- - text: Your `title` element should have a closing tag. Closing tags have a `/` just after the `<` character.
- testString: |
- assert( code.match(/\<\/title\>/) );
- - text: Your `title` element's text should be `CatPhotoApp`. You have either omitted the text or have a typo.
- testString: assert( document.title && document.title.toLowerCase() === 'catphotoapp' );
+You have either deleted the `head` element or it is missing an opening tag or closing tag.
+```js
+assert(code.match(/\/) && code.match(/\<\/head\>/));
```
-
+Your `title` element should be nested in the `head` element. Make sure to added an opening tag and closing tag for the `title` element.
-## Challenge Seed
-
-
+```js
+const noSpaces = code.replace(/\s/g, '');
+assert(noSpaces.match(/\\.*\<\/title\>\<\/head\>/));
+```
+
+Your `title` element should have a closing tag. Closing tags have a `/` just after the `<` character.
+
+```js
+assert(code.match(/\<\/title\>/));
+```
+
+Your `title` element's text should be `CatPhotoApp`. You have either omitted the text or have a typo.
+
+```js
+assert(document.title && document.title.toLowerCase() === 'catphotoapp');
+```
+
+# --seed--
+
+## --seed-contents--
```html
- --fcc-editable-region--
+--fcc-editable-region--
- --fcc-editable-region--
+--fcc-editable-region--
CatPhotoApp
@@ -104,5 +107,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-066.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-066.md
index c92070105a..f184e2ea88 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-066.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-066.md
@@ -4,36 +4,36 @@ title: Part 66
challengeType: 0
---
-## Description
-
+# --description--
Notice that the entire contents of the page are nested within an `html` element. All other elements must be descendants of this `html` element.
Add the `lang` attribute with the value `en` to the opening `html` tag to specify that the language of the page is English.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: You have either deleted the `html` element or it is missing an opening tag or closing tag.
- testString: assert( code.match(/\/) && code.match(/\<\/html\>/) );
- - text: Your `html` element should have a `lang` attribute with the value `en`. You may have omitted the attribute/value, or have a typo.
- testString: |
- const extraSpacesRemoved = code.replace(/\s+/g, ' ');
- assert( extraSpacesRemoved.match(/\/) );
- - text: Although you have set the `html` element's `lang` attribute to `en`, it is recommended to always surround the value of an attribute with quotation marks.
- testString: assert( !/\<\s*html\s+lang\s*=en/i.test(code) );
+You have either deleted the `html` element or it is missing an opening tag or closing tag.
+```js
+assert(code.match(/\/) && code.match(/\<\/html\>/));
```
-
+Your `html` element should have a `lang` attribute with the value `en`. You may have omitted the attribute/value, or have a typo.
-## Challenge Seed
-
-
+```js
+const extraSpacesRemoved = code.replace(/\s+/g, ' ');
+assert(extraSpacesRemoved.match(/\/));
+```
+
+Although you have set the `html` element's `lang` attribute to `en`, it is recommended to always surround the value of an attribute with quotation marks.
+
+```js
+assert(!/\<\s*html\s+lang\s*=en/i.test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```html
--fcc-editable-region--
@@ -102,5 +102,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-067.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-067.md
index caf68cc39f..fc670b963c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-067.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-067.md
@@ -4,34 +4,30 @@ title: Part 67
challengeType: 0
---
-## Description
-
+# --description--
All pages should begin with ``. This special string is known as a declaration and ensures the browser tries to meet industry-wide specifications.
To complete this project, add this declaration as the first line of the code.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: Your code should begin with the declaration ``. You may have omitted the declaration, have a typo, or it is not the first line of code.
- testString: assert( code.match(/\<\s*!DOCTYPE\s+html\s*\>/) );
- - text: Your `` must be located at the top of the document.
- testString: |
- const noSpaces = code.replace(/\s/g, '');
- assert( noSpaces.match(/^\<\!DOCTYPEhtml\>\`. You may have omitted the declaration, have a typo, or it is not the first line of code.
+```js
+assert(code.match(/\<\s*!DOCTYPE\s+html\s*\>/));
```
-
+Your `` must be located at the top of the document.
-## Challenge Seed
-
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -171,5 +163,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.md b/curriculum/challenges/english/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.md
index bb99a8c204..c0dae78d20 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.md
@@ -6,45 +6,63 @@ videoUrl: 'https://scrimba.com/p/pVaDAv/c9W7MhM'
forumTopicId: 301100
---
-## Description
-
-To the right is the tweet embed that will be used as the practical example. Some of the elements would look better with a different layout. The last challenge demonstrated display: flex. Here you'll add it to several components in the tweet embed to start adjusting their positioning.
-
+# --description--
-## Instructions
-
-Add the CSS property display: flex to all of the following items - note that the selectors are already set up in the CSS:
-header, the header's .profile-name, the header's .follow-btn, the header's h3 and h4, the footer, and the footer's .stats.
-
+To the right is the tweet embed that will be used as the practical example. Some of the elements would look better with a different layout. The last challenge demonstrated `display: flex`. Here you'll add it to several components in the tweet embed to start adjusting their positioning.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your header should have a display property set to flex.
- testString: assert($('header').css('display') == 'flex');
- - text: Your footer should have a display property set to flex.
- testString: assert($('footer').css('display') == 'flex');
- - text: Your h3 should have a display property set to flex.
- testString: assert($('h3').css('display') == 'flex');
- - text: Your h4 should have a display property set to flex.
- testString: assert($('h4').css('display') == 'flex');
- - text: Your .profile-name should have a display property set to flex.
- testString: assert($('.profile-name').css('display') == 'flex');
- - text: Your .follow-btn should have a display property set to flex.
- testString: assert($('.follow-btn').css('display') == 'flex');
- - text: Your .stats should have a display property set to flex.
- testString: assert($('.stats').css('display') == 'flex');
+Add the CSS property `display: flex` to all of the following items - note that the selectors are already set up in the CSS:
+`header`, the header's `.profile-name`, the header's `.follow-btn`, the header's `h3` and `h4`, the `footer`, and the footer's `.stats`.
+
+# --hints--
+
+Your `header` should have a `display` property set to `flex`.
+
+```js
+assert($('header').css('display') == 'flex');
```
-
+Your `footer` should have a `display` property set to `flex`.
-## Challenge Seed
-
+```js
+assert($('footer').css('display') == 'flex');
+```
-
+Your `h3` should have a `display` property set to `flex`.
+
+```js
+assert($('h3').css('display') == 'flex');
+```
+
+Your `h4` should have a `display` property set to `flex`.
+
+```js
+assert($('h4').css('display') == 'flex');
+```
+
+Your `.profile-name` should have a `display` property set to `flex`.
+
+```js
+assert($('.profile-name').css('display') == 'flex');
+```
+
+Your `.follow-btn` should have a `display` property set to `flex`.
+
+```js
+assert($('.follow-btn').css('display') == 'flex');
+```
+
+Your `.stats` should have a `display` property set to `flex`.
+
+```js
+assert($('.stats').css('display') == 'flex');
+```
+
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.md
index 00c8a9bf49..ec67d916c6 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.md
@@ -6,32 +6,29 @@ videoUrl: 'https://scrimba.com/p/pByETK/ca2qVtv'
forumTopicId: 301118
---
-## Description
-
-grid-gap is a shorthand property for grid-row-gap and grid-column-gap from the previous two challenges that's more convenient to use. If grid-gap has one value, it will create a gap between all rows and columns. However, if there are two values, it will use the first one to set the gap between the rows and the second value for the columns.
-
+# --description--
-## Instructions
-
-Use grid-gap to introduce a 10px gap between the rows and 20px gap between the columns.
-
+`grid-gap` is a shorthand property for `grid-row-gap` and `grid-column-gap` from the previous two challenges that's more convenient to use. If `grid-gap` has one value, it will create a gap between all rows and columns. However, if there are two values, it will use the first one to set the gap between the rows and the second value for the columns.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: container class should have a grid-gap property that introduces 10px gap between the rows and 20px gap between the columns.
- testString: assert(code.match(/.container\s*?{[\s\S]*grid-gap\s*?:\s*?10px\s+?20px\s*?;[\s\S]*}/gi));
+Use `grid-gap` to introduce a `10px` gap between the rows and `20px` gap between the columns.
+# --hints--
+
+`container` class should have a `grid-gap` property that introduces `10px` gap between the rows and `20px` gap between the columns.
+
+```js
+assert(
+ code.match(
+ /.container\s*?{[\s\S]*grid-gap\s*?:\s*?10px\s+?20px\s*?;[\s\S]*}/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.md
index e8f9993bdc..3cb6763068 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.md
@@ -6,32 +6,29 @@ videoUrl: 'https://scrimba.com/p/pByETK/cbp9Pua'
forumTopicId: 301119
---
-## Description
-
-The grid you created in the last challenge will set the number of rows automatically. To adjust the rows manually, use the grid-template-rows property in the same way you used grid-template-columns in previous challenge.
-
+# --description--
-## Instructions
-
-Add two rows to the grid that are 50px tall each.
-
+The grid you created in the last challenge will set the number of rows automatically. To adjust the rows manually, use the `grid-template-rows` property in the same way you used `grid-template-columns` in previous challenge.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: container class should have a grid-template-rows property with two units of 50px.
- testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-rows\s*?:\s*?50px\s*?50px\s*?;[\s\S]*}/gi));
+Add two rows to the grid that are `50px` tall each.
+# --hints--
+
+`container` class should have a `grid-template-rows` property with two units of `50px`.
+
+```js
+assert(
+ code.match(
+ /.container\s*?{[\s\S]*grid-template-rows\s*?:\s*?50px\s*?50px\s*?;[\s\S]*}/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.md
index f4245979c9..9ba38bb937 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.md
@@ -6,32 +6,29 @@ videoUrl: 'https://scrimba.com/p/pByETK/cJbpECn'
forumTopicId: 301120
---
-## Description
-
-Sometimes you want all the items in your CSS Grid to share the same alignment. You can use the previously learned properties and align them individually, or you can align them all at once horizontally by using justify-items on your grid container. This property can accept all the same values you learned about in the previous two challenges, the difference being that it will move all the items in our grid to the desired alignment.
-
+# --description--
+
+Sometimes you want all the items in your CSS Grid to share the same alignment. You can use the previously learned properties and align them individually, or you can align them all at once horizontally by using `justify-items` on your grid container. This property can accept all the same values you learned about in the previous two challenges, the difference being that it will move **all** the items in our grid to the desired alignment.
+
+# --instructions--
-## Instructions
-
Use this property to center all our items horizontally.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: container class should have a justify-items property that has the value of center.
- testString: assert(code.match(/.container\s*?{[\s\S]*justify-items\s*?:\s*?center\s*?;[\s\S]*}/gi));
+`container` class should have a `justify-items` property that has the value of `center`.
+```js
+assert(
+ code.match(
+ /.container\s*?{[\s\S]*justify-items\s*?:\s*?center\s*?;[\s\S]*}/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.md
index 23197a18f9..c346c5dec4 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.md
@@ -6,32 +6,27 @@ videoUrl: 'https://scrimba.com/p/pByETK/ckzPeUv'
forumTopicId: 301121
---
-## Description
-
-Using the align-items property on a grid container will set the vertical alignment for all the items in our grid.
-
+# --description--
+
+Using the `align-items` property on a grid container will set the vertical alignment for all the items in our grid.
+
+# --instructions--
-## Instructions
-
Use it now to move all the items to the end of each cell.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: container class should have a align-items property that has the value of end.
- testString: assert(code.match(/.container\s*?{[\s\S]*align-items\s*?:\s*?end\s*?;[\s\S]*}/gi));
+`container` class should have a `align-items` property that has the value of `end`.
+```js
+assert(
+ code.match(/.container\s*?{[\s\S]*align-items\s*?:\s*?end\s*?;[\s\S]*}/gi)
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.md
index 3edeeb6794..1842b32b38 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.md
@@ -6,35 +6,33 @@ videoUrl: 'https://scrimba.com/p/pByETK/cJbpKHq'
forumTopicId: 301122
---
-## Description
-
-In CSS Grid, the content of each item is located in a box which is referred to as a cell. You can align the content's position within its cell horizontally using the justify-self property on a grid item. By default, this property has a value of stretch, which will make the content fill the whole width of the cell. This CSS Grid property accepts other values as well:
-start: aligns the content at the left of the cell,
-center: aligns the content in the center of the cell,
-end: aligns the content at the right of the cell.
-
+# --description--
-## Instructions
-
-Use the justify-self property to center the item with the class item2.
-
+In CSS Grid, the content of each item is located in a box which is referred to as a cell. You can align the content's position within its cell horizontally using the `justify-self` property on a grid item. By default, this property has a value of `stretch`, which will make the content fill the whole width of the cell. This CSS Grid property accepts other values as well:
-## Tests
-
+`start`: aligns the content at the left of the cell,
-```yml
-tests:
- - text: item2 class should have a justify-self property that has the value of center.
- testString: assert(code.match(/.item2\s*?{[\s\S]*justify-self\s*?:\s*?center\s*?;[\s\S]*}/gi));
+`center`: aligns the content in the center of the cell,
+`end`: aligns the content at the right of the cell.
+
+# --instructions--
+
+Use the `justify-self` property to center the item with the class `item2`.
+
+# --hints--
+
+`item2` class should have a `justify-self` property that has the value of `center`.
+
+```js
+assert(
+ code.match(/.item2\s*?{[\s\S]*justify-self\s*?:\s*?center\s*?;[\s\S]*}/gi)
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.md
index 713a8ccc6a..d006df2caf 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.md
@@ -6,32 +6,25 @@ videoUrl: 'https://scrimba.com/p/pByETK/cmzd4fz'
forumTopicId: 301123
---
-## Description
-
-Just as you can align an item horizontally, there's a way to align an item vertically as well. To do this, you use the align-self property on an item. This property accepts all of the same values as justify-self from the last challenge.
-
+# --description--
-## Instructions
-
-Align the item with the class item3 vertically at the end.
-
+Just as you can align an item horizontally, there's a way to align an item vertically as well. To do this, you use the `align-self` property on an item. This property accepts all of the same values as `justify-self` from the last challenge.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: item3 class should have a align-self property that has the value of end.
- testString: assert(code.match(/.item3\s*?{[\s\S]*align-self\s*?:\s*?end\s*?;[\s\S]*}/gi));
+Align the item with the class `item3` vertically at the `end`.
+# --hints--
+
+`item3` class should have a `align-self` property that has the value of `end`.
+
+```js
+assert(code.match(/.item3\s*?{[\s\S]*align-self\s*?:\s*?end\s*?;[\s\S]*}/gi));
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.md
index c31d9b1f05..06298ca562 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.md
@@ -6,38 +6,35 @@ videoUrl: 'https://scrimba.com/p/pByETK/cVZ8vfD'
forumTopicId: 301124
---
-## Description
-
-So far in the grids you have created, the columns have all been tight up against each other. Sometimes you want a gap in between the columns. To add a gap between the columns, use the grid-column-gap property like this:
+# --description--
+
+So far in the grids you have created, the columns have all been tight up against each other. Sometimes you want a gap in between the columns. To add a gap between the columns, use the `grid-column-gap` property like this:
```css
grid-column-gap: 10px;
```
This creates 10px of empty space between all of our columns.
-
-## Instructions
-
-Give the columns in the grid a 20px gap.
-
+# --instructions--
-## Tests
-
+Give the columns in the grid a `20px` gap.
-```yml
-tests:
- - text: container class should have a grid-column-gap property that has the value of 20px.
- testString: assert(code.match(/.container\s*?{[\s\S]*grid-column-gap\s*?:\s*?20px\s*?;[\s\S]*}/gi));
+# --hints--
+`container` class should have a `grid-column-gap` property that has the value of `20px`.
+
+```js
+assert(
+ code.match(
+ /.container\s*?{[\s\S]*grid-column-gap\s*?:\s*?20px\s*?;[\s\S]*}/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.md
index 2b88c19550..133593374c 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.md
@@ -6,32 +6,27 @@ videoUrl: 'https://scrimba.com/p/pByETK/cPbJ2Cv'
forumTopicId: 301125
---
-## Description
-
-You can add a gap in between the rows of a grid using grid-row-gap in the same way that you added a gap in between columns in the previous challenge.
-
+# --description--
-## Instructions
-
-Create a gap for the rows that is 5px tall.
-
+You can add a gap in between the rows of a grid using `grid-row-gap` in the same way that you added a gap in between columns in the previous challenge.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: container class should have a grid-row-gap property that has the value of 5px.
- testString: assert(code.match(/.container\s*?{[\s\S]*grid-row-gap\s*?:\s*?5px\s*?;[\s\S]*}/gi));
+Create a gap for the rows that is `5px` tall.
+# --hints--
+
+`container` class should have a `grid-row-gap` property that has the value of `5px`.
+
+```js
+assert(
+ code.match(/.container\s*?{[\s\S]*grid-row-gap\s*?:\s*?5px\s*?;[\s\S]*}/gi)
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.md
index c22f9e24a2..06e3812191 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.md
@@ -6,39 +6,35 @@ videoUrl: 'https://scrimba.com/p/pByETK/cmzdycW'
forumTopicId: 301126
---
-## Description
-
-The repeat function comes with an option called auto-fill. This allows you to automatically insert as many rows or columns of your desired size as possible depending on the size of the container. You can create flexible layouts when combining auto-fill with minmax, like this:
+# --description--
+
+The repeat function comes with an option called auto-fill. This allows you to automatically insert as many rows or columns of your desired size as possible depending on the size of the container. You can create flexible layouts when combining `auto-fill` with `minmax`, like this:
```css
repeat(auto-fill, minmax(60px, 1fr));
```
-When the container changes size, this setup keeps inserting 60px columns and stretching them until it can insert another one.
-Note: If your container can't fit all your items on one row, it will move them down to a new one.
-
+When the container changes size, this setup keeps inserting 60px columns and stretching them until it can insert another one. **Note:** If your container can't fit all your items on one row, it will move them down to a new one.
-## Instructions
-
-In the first grid, use auto-fill with repeat to fill the grid with columns that have a minimum width of 60px and maximum of 1fr. Then resize the preview to see auto-fill in action.
-
+# --instructions--
-## Tests
-
+In the first grid, use `auto-fill` with `repeat` to fill the grid with columns that have a minimum width of `60px` and maximum of `1fr`. Then resize the preview to see auto-fill in action.
-```yml
-tests:
- - text: container class should have a grid-template-columns property with repeat and auto-fill that will fill the grid with columns that have a minimum width of 60px and maximum of 1fr.
- testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fill\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi));
+# --hints--
+`container` class should have a `grid-template-columns` property with `repeat` and `auto-fill` that will fill the grid with columns that have a minimum width of `60px` and maximum of `1fr`.
+
+```js
+assert(
+ code.match(
+ /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fill\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-grids-within-grids.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-grids-within-grids.md
index b2c5ea66a1..39656e2f36 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-grids-within-grids.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-grids-within-grids.md
@@ -5,35 +5,37 @@ challengeType: 0
forumTopicId: 301128
---
-## Description
-
-Turning an element into a grid only affects the behavior of its direct descendants. So by turning a direct descendant into a grid, you have a grid within a grid.
-For example, by setting the display and grid-template-columns properties of the element with the item3 class, you create a grid within your grid.
-
+# --description--
-## Instructions
-
-Turn the element with the item3 class into a grid with two columns with a width of auto and 1fr using display and grid-template-columns.
-
+Turning an element into a grid only affects the behavior of its direct descendants. So by turning a direct descendant into a grid, you have a grid within a grid.
-## Tests
-
+For example, by setting the `display` and `grid-template-columns` properties of the element with the `item3` class, you create a grid within your grid.
-```yml
-tests:
- - text: item3 class should have a grid-template-columns property with auto and 1fr as values.
- testString: assert(code.match(/.item3\s*?{[\s\S]*grid-template-columns\s*?:\s*?auto\s*?1fr\s*?;[\s\S]*}/gi));
- - text: item3 class should have a display property with the value of grid.
- testString: assert(code.match(/.item3\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));
+# --instructions--
+Turn the element with the `item3` class into a grid with two columns with a width of `auto` and `1fr` using `display` and `grid-template-columns`.
+
+# --hints--
+
+`item3` class should have a `grid-template-columns` property with `auto` and `1fr` as values.
+
+```js
+assert(
+ code.match(
+ /.item3\s*?{[\s\S]*grid-template-columns\s*?:\s*?auto\s*?1fr\s*?;[\s\S]*}/gi
+ )
+);
```
-
+`item3` class should have a `display` property with the value of `grid`.
-## Challenge Seed
-
+```js
+assert(code.match(/.item3\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));
+```
-
+# --seed--
+
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-your-first-css-grid.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-your-first-css-grid.md
index 44bb1b5cac..51f0b54d35 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/create-your-first-css-grid.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/create-your-first-css-grid.md
@@ -6,33 +6,27 @@ videoUrl: 'https://scrimba.com/p/pByETK/cqwREC4'
forumTopicId: 301129
---
-## Description
-
-Turn any HTML element into a grid container by setting its display property to grid. This gives you the ability to use all the other properties associated with CSS Grid.
-Note: In CSS Grid, the parent element is referred to as the container and its children are called items.
-
+# --description--
-## Instructions
-
-Change the display of the div with the container class to grid.
-
+Turn any HTML element into a grid container by setting its `display` property to `grid`. This gives you the ability to use all the other properties associated with CSS Grid.
-## Tests
-
+**Note:** In CSS Grid, the parent element is referred to as the container and its children are called items.
-```yml
-tests:
- - text: container class should have a display property with a value of grid.
- testString: assert(code.match(/.container\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));
+# --instructions--
+Change the display of the div with the `container` class to `grid`.
+
+# --hints--
+
+`container` class should have a `display` property with a value of `grid`.
+
+```js
+assert(code.match(/.container\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.md
index f8a7127713..cf17cdc93b 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/p/pByETK/cLLpGAy'
forumTopicId: 301130
---
-## Description
-
-You can group cells of your grid together into an area and give the area a custom name. Do this by using grid-template-areas on the container like this:
+# --description--
+
+You can group cells of your grid together into an area and give the area a custom name. Do this by using `grid-template-areas` on the container like this:
```css
grid-template-areas:
@@ -17,32 +17,29 @@ grid-template-areas:
"footer footer footer";
```
-The code above merges the top three cells together into an area named header, the bottom three cells into a footer area, and it makes two areas in the middle row; advert and content.
-Note: Every word in the code represents a cell and every pair of quotation marks represent a row.
-In addition to custom labels, you can use a period (.) to designate an empty cell in the grid.
-
+The code above merges the top three cells together into an area named `header`, the bottom three cells into a `footer` area, and it makes two areas in the middle row; `advert` and `content`. **Note:** Every word in the code represents a cell and every pair of quotation marks represent a row. In addition to custom labels, you can use a period (`.`) to designate an empty cell in the grid.
-## Instructions
-
-Place the area template so that the cell labeled advert becomes an empty cell.
-
+# --instructions--
-## Tests
-
+Place the area template so that the cell labeled `advert` becomes an empty cell.
-```yml
-tests:
- - text: container class should have a grid-template-areas property similar to the preview but has . instead of the advert area.
- testString: assert(__helpers.removeCssComments(code).match(/.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?header\s*?"\s*?"\s*?.\s*?content\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi));
+# --hints--
+`container` class should have a `grid-template-areas` property similar to the preview but has `.` instead of the `advert` area.
+
+```js
+assert(
+ __helpers
+ .removeCssComments(code)
+ .match(
+ /.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?header\s*?"\s*?"\s*?.\s*?content\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.md
index 60be806fca..4ef887b9a7 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/p/pByETK/cRrqmtV'
forumTopicId: 301132
---
-## Description
-
-After creating an area's template for your grid container, as shown in the previous challenge, you can place an item in your custom area by referencing the name you gave it. To do this, you use the grid-area property on an item like this:
+# --description--
+
+After creating an area's template for your grid container, as shown in the previous challenge, you can place an item in your custom area by referencing the name you gave it. To do this, you use the `grid-area` property on an item like this:
```css
.item1 {
@@ -16,30 +16,27 @@ After creating an area's template for your grid container, as shown in the previ
}
```
-This lets the grid know that you want the item1 class to go in the area named header. In this case, the item will use the entire top row because that whole row is named as the header area.
-
+This lets the grid know that you want the `item1` class to go in the area named `header`. In this case, the item will use the entire top row because that whole row is named as the header area.
-## Instructions
-
-Place an element with the item5 class in the footer area using the grid-area property.
-
+# --instructions--
-## Tests
-
+Place an element with the `item5` class in the `footer` area using the `grid-area` property.
-```yml
-tests:
- - text: item5 class should have a grid-area property that has the value of footer.
- testString: assert(__helpers.removeCssComments(code).match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?footer\s*?;[\s\S]*}/gi));
+# --hints--
+`item5` class should have a `grid-area` property that has the value of `footer`.
+
+```js
+assert(
+ __helpers
+ .removeCssComments(code)
+ .match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?footer\s*?;[\s\S]*}/gi)
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.md
index d1c7eef61d..cc61b7f348 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/p/pByETK/cQvqyHR'
forumTopicId: 301133
---
-## Description
-
-When you used grid-template-columns and grid-template-rows to define the structure of a grid, you entered a value for each row or column you created.
-Let's say you want a grid with 100 rows of the same height. It isn't very practical to insert 100 values individually. Fortunately, there's a better way - by using the repeat function to specify the number of times you want your column or row to be repeated, followed by a comma and the value you want to repeat.
+# --description--
+
+When you used `grid-template-columns` and `grid-template-rows` to define the structure of a grid, you entered a value for each row or column you created.
+
+Let's say you want a grid with 100 rows of the same height. It isn't very practical to insert 100 values individually. Fortunately, there's a better way - by using the `repeat` function to specify the number of times you want your column or row to be repeated, followed by a comma and the value you want to repeat.
+
Here's an example that would create the 100 row grid, each row at 50px tall.
```css
@@ -28,30 +30,27 @@ This translates to:
grid-template-columns: 1fr 50px 1fr 50px 20px;
```
-Note: The 1fr 50px is repeated twice followed by 20px.
-
+**Note:** The `1fr 50px` is repeated twice followed by 20px.
-## Instructions
-
-Use repeat to remove repetition from the grid-template-columns property.
-
+# --instructions--
-## Tests
-
+Use `repeat` to remove repetition from the `grid-template-columns` property.
-```yml
-tests:
- - text: container class should have a grid-template-columns property that is set to repeat 3 columns with the width of 1fr.
- testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?1fr\s*?\)\s*?;[\s\S]*}/gi));
+# --hints--
+`container` class should have a `grid-template-columns` property that is set to repeat 3 columns with the width of `1fr`.
+
+```js
+assert(
+ code.match(
+ /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?1fr\s*?\)\s*?;[\s\S]*}/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows.md
index 0e4b23a71c..ca115a3968 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/use-css-grid-units-to-change-the-size-of-columns-and-rows.md
@@ -6,12 +6,16 @@ videoUrl: 'https://scrimba.com/p/pByETK/cvE8phd'
forumTopicId: 301134
---
-## Description
-
-You can use absolute and relative units like px and em in CSS Grid to define the size of rows and columns. You can use these as well:
-fr: sets the column or row to a fraction of the available space,
-auto: sets the column or row to the width or height of its content automatically,
-%: adjusts the column or row to the percent width of its container.
+# --description--
+
+You can use absolute and relative units like `px` and `em` in CSS Grid to define the size of rows and columns. You can use these as well:
+
+`fr`: sets the column or row to a fraction of the available space,
+
+`auto`: sets the column or row to the width or height of its content automatically,
+
+`%`: adjusts the column or row to the percent width of its container.
+
Here's the code that generates the output in the preview:
```css
@@ -19,29 +23,26 @@ grid-template-columns: auto 50px 10% 2fr 1fr;
```
This snippet creates five columns. The first column is as wide as its content, the second column is 50px, the third column is 10% of its container, and for the last two columns; the remaining space is divided into three sections, two are allocated for the fourth column, and one for the fifth.
-
-## Instructions
-
+# --instructions--
+
Make a grid with three columns whose widths are as follows: 1fr, 100px, and 2fr.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: 'container class should have a grid-template-columns property that has three columns with the following widths: 1fr, 100px, and 2fr.'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?1fr\s*?100px\s*?2fr\s*?;[\s\S]*}/gi));'
+`container` class should have a `grid-template-columns` property that has three columns with the following widths: `1fr, 100px, and 2fr`.
+```js
+assert(
+ code.match(
+ /.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?1fr\s*?100px\s*?2fr\s*?;[\s\S]*}/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.md
index 63426e603e..b1fef82f74 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/p/pByETK/c6N7VhK'
forumTopicId: 301135
---
-## Description
-
-The grid-area property you learned in the last challenge can be used in another way. If your grid doesn't have an areas template to reference, you can create an area on the fly for an item to be placed like this:
+# --description--
+
+The `grid-area` property you learned in the last challenge can be used in another way. If your grid doesn't have an areas template to reference, you can create an area on the fly for an item to be placed like this:
```css
item1 { grid-area: 1/1/2/4; }
@@ -21,29 +21,26 @@ grid-area: horizontal line to start at / vertical line to start at / horizontal
```
So the item in the example will consume the rows between lines 1 and 2, and the columns between lines 1 and 4.
-
-## Instructions
-
-Using the grid-area property, place the element with item5 class between the third and fourth horizontal lines and between the first and fourth vertical lines.
-
+# --instructions--
-## Tests
-
+Using the `grid-area` property, place the element with `item5` class between the third and fourth horizontal lines and between the first and fourth vertical lines.
-```yml
-tests:
- - text: The item5 class should have a grid-area property to make it fill the whole area between the third and fourth horizontal lines, and first and fourth vertical lines.
- testString: assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?3\s*?\/\s*?1\s*?\/\s*?4\s*?\/\s*?4\s*?;[\s\S]*}/gi));
+# --hints--
+The `item5` class should have a `grid-area` property to make it fill the whole area between the third and fourth horizontal lines, and first and fourth vertical lines.
+
+```js
+assert(
+ code.match(
+ /.item5\s*?{[\s\S]*grid-area\s*?:\s*?3\s*?\/\s*?1\s*?\/\s*?4\s*?\/\s*?4\s*?;[\s\S]*}/gi
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```html
```
-
-
diff --git a/curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.md b/curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.md
index 865ec3d707..de585244ea 100644
--- a/curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.md
+++ b/curriculum/challenges/english/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.md
@@ -6,13 +6,18 @@ videoUrl: 'https://scrimba.com/p/pByETK/cnzkDSr'
forumTopicId: 301136
---
-## Description
-
-Up to this point, all the properties that have been discussed are for grid containers. The grid-column property is the first one for use on the grid items themselves.
+# --description--
+
+Up to this point, all the properties that have been discussed are for grid containers. The `grid-column` property is the first one for use on the grid items themselves.
+
The hypothetical horizontal and vertical lines that create the grid are referred to as lines. These lines are numbered starting with 1 at the top left corner of the grid and move right for columns and down for rows, counting upward.
-This is what the lines look like for a 3x3 grid:
-
column lines
1
2
3
4
row lines
1
2
3
4
-To control the amount of columns an item will consume, you can use the grid-column property in conjunction with the line numbers you want the item to start and stop at.
+
+This is what the lines look like for a 3x3 grid:
+
+
column lines
1
2
3
4
row lines
1
2
3
4
+
+To control the amount of columns an item will consume, you can use the `grid-column` property in conjunction with the line numbers you want the item to start and stop at.
+
Here's an example:
```css
@@ -20,37 +25,46 @@ grid-column: 1 / 3;
```
This will make the item start at the first vertical line of the grid on the left and span to the 3rd line of the grid, consuming two columns.
-
-## Instructions
-
-Make the item with the class item5 consume the last two columns of the grid.
-
+# --instructions--
-## Tests
-
+Make the item with the class `item5` consume the last two columns of the grid.
-```yml
-tests:
- - text: item5 class should have a grid-column property.
- testString: assert(__helpers.removeWhiteSpace($('style').text()).match(/\.item5{.*grid-column:.*}/g));
- - text: item5 class should have a grid-column property which results in it consuming the last two columns of the grid.
- testString: "
- const colStart = getComputedStyle($('.item5')[0]).gridColumnStart;
- const colEnd = getComputedStyle($('.item5')[0]).gridColumnEnd;
- const result = colStart.toString() + colEnd.toString();
- const correctResults = ['24', '2-1', '2span 2', '2span2', 'span 2-1', '-12', 'span 2span 2', 'span 2auto', 'autospan 2'];
- assert(correctResults.includes(result));
- "
+# --hints--
+`item5` class should have a `grid-column` property.
+
+```js
+assert(
+ __helpers
+ .removeWhiteSpace($('style').text())
+ .match(/\.item5{.*grid-column:.*}/g)
+);
```
-
+`item5` class should have a `grid-column` property which results in it consuming the last two columns of the grid.
-## Challenge Seed
-
+```js
+const colStart = getComputedStyle($('.item5')[0]).gridColumnStart;
+const colEnd = getComputedStyle($('.item5')[0]).gridColumnEnd;
+const result = colStart.toString() + colEnd.toString();
+const correctResults = [
+ '24',
+ '2-1',
+ '2span 2',
+ '2span2',
+ 'span 2-1',
+ '-12',
+ 'span 2span 2',
+ 'span 2auto',
+ 'autospan 2'
+];
+assert(correctResults.includes(result));
+```
-
+# --seed--
+
+## --seed-contents--
```html
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-029.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-029.md
index 542adecad8..c7025f880f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-029.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-029.md
@@ -4,8 +4,7 @@ title: Part 29
challengeType: 0
---
-## Description
-
+# --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.
@@ -13,29 +12,90 @@ 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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert.deepStrictEqual(JSON.stringify(locations), `[{}]`);
+See description above for instructions.
+```js
+assert.deepStrictEqual(JSON.stringify(locations), `[{}]`);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-030.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-030.md
index 30acc1099c..435e8d7a8d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-030.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-030.md
@@ -4,8 +4,7 @@ title: Part 30
challengeType: 0
---
-## Description
-
+# --description--
Inside the object you just added, create a property called `name` with the value of "town square".
@@ -19,29 +18,90 @@ const arr = [
]
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(locations[0].name === 'town square');
+See description above for instructions.
+```js
+assert(locations[0].name === 'town square');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-031.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-031.md
index da536421c4..48015cb4b0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-031.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-031.md
@@ -4,8 +4,7 @@ title: Part 31
challengeType: 0
---
-## Description
-
+# --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.
@@ -20,29 +19,90 @@ const arr = [
]
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert.deepStrictEqual(locations[0]['button text'], []);
+See description above for instructions.
+```js
+assert.deepStrictEqual(locations[0]['button text'], []);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-032.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-032.md
index 3cb012542c..dfe9bf3182 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-032.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-032.md
@@ -4,36 +4,100 @@ title: Part 32
challengeType: 0
---
-## Description
-
+# --description--
-Inside the `"button text"` array, add three string elements. Use the three stings assigned to the buttons inside the `goTown` function.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert.deepStrictEqual(locations[0]['button text'], ["Go to store","Go to cave","Fight dragon"]);
+See description above for instructions.
+```js
+assert.deepStrictEqual(locations[0]['button text'], [
+ 'Go to store',
+ 'Go to cave',
+ 'Fight dragon'
+]);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-033.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-033.md
index e42e5a56b4..db881e5871 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-033.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-033.md
@@ -4,34 +4,98 @@ title: Part 33
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert.deepStrictEqual(locations[0]['button functions'], [goStore, goCave, fightDragon]);
+See description above for instructions.
+```js
+assert.deepStrictEqual(locations[0]['button functions'], [
+ goStore,
+ goCave,
+ fightDragon
+]);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-034.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-034.md
index d16b0ba894..6735624eb8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-034.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-034.md
@@ -4,34 +4,97 @@ title: Part 34
challengeType: 0
---
-## Description
-
+# --description--
Add one final property to the object named `text`. The value should be the final text from the `goTown` function.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(locations[0].text === "You are in the town square. You see a sign that says \"Store.\"");
+See description above for instructions.
+```js
+assert(
+ locations[0].text ===
+ 'You are in the town square. You see a sign that says "Store."'
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-035.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-035.md
index 602409a620..d88d0d0795 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-035.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-035.md
@@ -4,35 +4,103 @@ title: Part 35
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- 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." });
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-036.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-036.md
index c4fb187782..b1e33332a8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-036.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-036.md
@@ -4,35 +4,110 @@ title: Part 36
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- # testString: assert(goTown.toString() === "function goTown() {}" && goStore.toString() === "function goStore() {}" && update.toString().match(/button1\.innerText\s*\=\s*[\'\"\`]Go to store[\'\"\`]/) && update.toString().match(/button2\.innerText\s*\=\s*[\'\"\`]Go to cave[\'\"\`]/) && update.toString().match(/button3\.innerText\s*\=\s*[\'\"\`]Fight dragon\.?[\'\"\`]/) && update.toString().match(/button1\.onclick\s*\=\s*goStore\;?/) && update.toString().match(/button2\.onclick\s*\=\s*goCave\;?/) && update.toString().match(/button3\.onclick\s*\=\s*fightDragon\;?/) && update.toString().match(/text\.innerText\s*\=\s*[\'\"\`]You are in the town square\. You see a sign that says \\\"[sS]tore\\\"\.?[\'\"\`]/));
- testString: 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\;?/)})());
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-037.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-037.md
index dcb63cf53f..c101fec18d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-037.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-037.md
@@ -4,36 +4,96 @@ title: Part 37
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(goTown.toString().match(/update\(\)/));
+See description above for instructions.
+```js
+assert(goTown.toString().match(/update\(\)/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-038.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-038.md
index 53e52250aa..ec738afb37 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-038.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-038.md
@@ -4,36 +4,96 @@ title: Part 38
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(goTown.toString().match(/update\(locations\)/));
+See description above for instructions.
+```js
+assert(goTown.toString().match(/update\(locations\)/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-039.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-039.md
index 820d3e3c57..f3400fed7f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-039.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-039.md
@@ -4,34 +4,94 @@ title: Part 39
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(goTown.toString().match(/update\(locations\[0\]\)/));
+See description above for instructions.
+```js
+assert(goTown.toString().match(/update\(locations\[0\]\)/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-040.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-040.md
index 25992e65f0..865f5b0d81 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-040.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-040.md
@@ -4,36 +4,100 @@ title: Part 40
challengeType: 0
---
-## Description
-
+# --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`.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(update.toString().match(/button1\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]/));
+See description above for instructions.
+```js
+assert(
+ update
+ .toString()
+ .match(/button1\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]/)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-041.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-041.md
index e4ebe018ac..86befa0e04 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-041.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-041.md
@@ -4,34 +4,100 @@ title: Part 41
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(update.toString().match(/button1\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]\[0\]/));
+See description above for instructions.
+```js
+assert(
+ update
+ .toString()
+ .match(
+ /button1\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]\[0\]/
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-042.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-042.md
index 632b77c795..963b267e3e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-042.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-042.md
@@ -4,34 +4,105 @@ title: Part 42
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(update.toString().match(/button2\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]\[1\]/) && update.toString().match(/button3\.innerText\s*\=\s*location\[[\'\"\`]button text[\'\"\`]\]\[2\]/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-043.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-043.md
index ec9b3530f2..bbc59ef8e3 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-043.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-043.md
@@ -4,34 +4,110 @@ title: Part 43
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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\]/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-044.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-044.md
index 5f638d6b87..cfc4d94858 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-044.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-044.md
@@ -4,36 +4,96 @@ title: Part 44
challengeType: 0
---
-## Description
-
+# --description--
-Finally, update `text.innerText` to equal the `text` from the location object.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(update.toString().match(/text\.innerText\s*\=\s*location\.text\;?/));
+See description above for instructions.
+```js
+assert(update.toString().match(/text\.innerText\s*\=\s*location\.text\;?/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-045.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-045.md
index bd0dca2d29..5d9726bd60 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-045.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-045.md
@@ -4,34 +4,94 @@ title: Part 45
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(goStore.toString().match(/update\(locations\[1\]\)/));
+See description above for instructions.
+```js
+assert(goStore.toString().match(/update\(locations\[1\]\)/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-046.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-046.md
index c8918a90ae..bc91de7459 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-046.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-046.md
@@ -4,37 +4,106 @@ title: Part 46
challengeType: 0
---
-## Description
-
+# --description--
-Add a third object in the `locations` array with the same properties as the other two objects.
+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.".
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- 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." });
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-047.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-047.md
index c7ccf46b86..b8e67f59e7 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-047.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-047.md
@@ -4,34 +4,99 @@ title: Part 47
challengeType: 0
---
-## Description
-
+# --description--
Now update the `goCave` function using the pattern from `goTown` and `goCave`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(goCave.toString().match(/update\(locations\[2\]\)\;?/));
+See description above for instructions.
+```js
+assert(goCave.toString().match(/update\(locations\[2\]\)\;?/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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.
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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-049.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-049.md
index f6c1105856..4680824697 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-049.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-049.md
@@ -4,37 +4,96 @@ title: Part 49
challengeType: 0
---
-## Description
-
+# --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.
+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;`.
+For example here is how you would set set `num` to equal 5 less than `num`: `num = num - 5;`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- # testString: assert((() => { buyHealth(); return gold === 40; })());
- testString: buyHealth(), assert(gold === 40);
+See description above for instructions.
+```js
+buyHealth(), assert(gold === 40);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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.
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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-051.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-051.md
index 7786be2e58..2b5eb2c8bf 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-051.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-051.md
@@ -4,36 +4,99 @@ title: Part 51
challengeType: 0
---
-## Description
-
+# --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.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(buyHealth.toString().match(/gold\s*\-\=\s*10\;?/) && buyHealth.toString().match(/health\s*\+\=\s*10\;?/));
+See description above for instructions.
+```js
+assert(
+ buyHealth.toString().match(/gold\s*\-\=\s*10\;?/) &&
+ buyHealth.toString().match(/health\s*\+\=\s*10\;?/)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-052.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-052.md
index 5a2fa42861..49c19aa985 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-052.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-052.md
@@ -4,35 +4,97 @@ title: Part 52
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(buyHealth.toString().match(/goldText\.innerText\s*\=\s*gold\;?/) && buyHealth.toString().match(/healthText.innerText\s*\=\s*health\;?/));
- # testString: assert((() => { buyHealth(); return goldText.innerText === '40' && healthText.innerText === '110'; })());
+See description above for instructions.
+```js
+assert(
+ buyHealth.toString().match(/goldText\.innerText\s*\=\s*gold\;?/) &&
+ buyHealth.toString().match(/healthText.innerText\s*\=\s*health\;?/)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-053.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-053.md
index 76e7661f77..551654fee1 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-053.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-053.md
@@ -4,8 +4,7 @@ title: Part 53
challengeType: 0
---
-## Description
-
+# --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:
@@ -19,30 +18,100 @@ function checkMoney() {
Note: For now you should use the word "condition" inside the `if` statement but we'll be changing that next.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- # testString: assert(buyHealth.toString().match(/if\s*\(\s*condition\s*\)\s*\{\s*gold\s*\-\=\s*10\;?\s*health\s*\+\=\s*10\;?\s*goldText\.innerText\s*\=\s*gold\;?\s*healthText\.innerText\s*\=\s*health\;?\s*\}\s*\}/));
- testString: 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\;?/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-054.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-054.md
index 06f5b91979..2f2f1660f6 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-054.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-054.md
@@ -4,10 +4,9 @@ title: Part 54
challengeType: 0
---
-## Description
-
+# --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.
+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:
@@ -17,29 +16,90 @@ if (num >= 5) {
}
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(buyHealth.toString().match(/if\s*\(\s*gold\s*\>\=\s*10\s*\)/));
+See description above for instructions.
+```js
+assert(buyHealth.toString().match(/if\s*\(\s*gold\s*\>\=\s*10\s*\)/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-055.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-055.md
index 0db3480674..2f0d774f0a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-055.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-055.md
@@ -4,10 +4,9 @@ title: Part 55
challengeType: 0
---
-## Description
-
+# --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.
+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:
@@ -18,29 +17,90 @@ if (num >= 5) {
}
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(buyHealth.toString().match(/\}\s*else\s*\{\s*\}/));
+See description above for instructions.
+```js
+assert(buyHealth.toString().match(/\}\s*else\s*\{\s*\}/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-056.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-056.md
index 3372346a87..87d078967d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-056.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-056.md
@@ -4,36 +4,96 @@ title: Part 56
challengeType: 0
---
-## Description
-
+# --description--
Inside the `else` statement, set `text.innerText` to equal "You do not have enough gold to buy health."
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- # testString: assert(buyHealth.toString().match(/\}\s*else\s*\{\s*text\.innerText\s*\=\s*[\'\"\`]You do not have enough gold to buy health\.?[\'\"\`]\;?\s*\}/));
- # testString: assert((() => { gold = 5; buyHealth(); return text.innerText === "You do not have enough gold to buy health."; })());
- testString: gold = 5, buyHealth(), assert(text.innerText === "You do not have enough gold to buy health.");
+See description above for instructions.
+```js
+(gold = 5),
+ buyHealth(),
+ assert(text.innerText === 'You do not have enough gold to buy health.');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-057.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-057.md
index 3b6a0ee2af..1fe72909bf 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-057.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-057.md
@@ -4,34 +4,94 @@ title: Part 57
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert.deepStrictEqual(weapons, []);
+See description above for instructions.
+```js
+assert.deepStrictEqual(weapons, []);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-058.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-058.md
index f0d260b2c4..36296075cc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-058.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-058.md
@@ -4,35 +4,99 @@ title: Part 58
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- assert.deepStrictEqual(weapons, [{name: "stick",power: 5},{name: "dagger",power: 30},{name: "claw hammer",power: 50},{name: "sword",power: 100}]);
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-059.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-059.md
index 985a87fa52..d316dfb010 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-059.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-059.md
@@ -4,34 +4,94 @@ title: Part 59
challengeType: 0
---
-## Description
-
+# --description--
Inside the `buyWeapon` function, add an `if` statement to check if gold is greater than or equal to 30.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(buyWeapon.toString().match(/if\s*\(\s*gold\s*\>\=\s*30\)\s*\{\s*\}/));
+See description above for instructions.
+```js
+assert(buyWeapon.toString().match(/if\s*\(\s*gold\s*\>\=\s*30\)\s*\{\s*\}/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-060.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-060.md
index c17f51581b..22da83a0b9 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-060.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-060.md
@@ -4,35 +4,94 @@ title: Part 60
challengeType: 0
---
-## Description
-
+# --description--
Similar to in the `buyHealth` function, set `gold` to equal 30 less than its current value.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- # testString: assert((() => { gold = 50; buyWeapon(); return gold === 20; })());
- testString: gold = 50, buyWeapon(), assert(gold === 20);
+See description above for instructions.
+```js
+(gold = 50), buyWeapon(), assert(gold === 20);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-061.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-061.md
index 6ace885e07..6dd6b3ab37 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-061.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-061.md
@@ -4,35 +4,94 @@ title: Part 61
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- # testString: assert((() => { currentWeapon = 0; buyWeapon(); return currentWeapon === 1; })());
- testString: currentWeapon = 0, buyWeapon(), assert(currentWeapon === 1);
+See description above for instructions.
+```js
+(currentWeapon = 0), buyWeapon(), assert(currentWeapon === 1);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-062.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-062.md
index 07ceb1c92f..efd1bc5015 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-062.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-062.md
@@ -4,8 +4,7 @@ title: Part 62
challengeType: 0
---
-## Description
-
+# --description--
You can easily increment or add one to a variable with the `++` operator. All three of these statements add one to a number:
@@ -17,29 +16,90 @@ num++;
Change the line `currentWeapon += 1;` to use the `++` operator.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(buyWeapon.toString().match(/currentWeapon\s*\+\+\;?/));
+See description above for instructions.
+```js
+assert(buyWeapon.toString().match(/currentWeapon\s*\+\+\;?/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-063.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-063.md
index 894d7a5899..67eb8c7482 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-063.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-063.md
@@ -4,36 +4,98 @@ title: Part 63
challengeType: 0
---
-## Description
-
+# --description--
Now update the `innerText` property of `goldText` and `text`. `text` should equal "You now have a new weapon.".
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- # testString: assert(buyWeapon.toString().match(/goldText\.innerText\s*\=\s*gold\;/) && buyWeapon.toString().match(/text\.innerText\s*\=\s*[\'\"\`]You now have a new weapon\.?[\'\"\`]\;?/));
- # testString: assert((() => { buyWeapon(); return goldText.innerText === '20' && text.innerText === 'You now have a new weapon.' })());
- testString: buyWeapon(), assert(goldText.innerText === '20' && text.innerText === 'You now have a new weapon.');
+See description above for instructions.
+```js
+buyWeapon(),
+ assert(
+ goldText.innerText === '20' &&
+ text.innerText === 'You now have a new weapon.'
+ );
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-064.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-064.md
index 96c0fbbf23..35a164631e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-064.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-064.md
@@ -4,34 +4,94 @@ title: Part 64
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(/let\s*newWeapon\s*\=\s*weapons\;?/.test(code));
+See description above for instructions.
+```js
+assert(/let\s*newWeapon\s*\=\s*weapons\;?/.test(code));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-065.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-065.md
index b017565c7a..e963708f03 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-065.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-065.md
@@ -4,34 +4,94 @@ title: Part 65
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(/let\s*newWeapon\s*\=\s*weapons\s?\[currentWeapon\]\;?/.test(code));
+See description above for instructions.
+```js
+assert(/let\s*newWeapon\s*\=\s*weapons\s?\[currentWeapon\]\;?/.test(code));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-066.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-066.md
index 7446c70602..3791f39f42 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-066.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-066.md
@@ -4,34 +4,96 @@ title: Part 66
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(/let\s*newWeapon\s*\=\s*weapons\s?\[currentWeapon\]\.name\;?/.test(code));
+See description above for instructions.
+```js
+assert(
+ /let\s*newWeapon\s*\=\s*weapons\s?\[currentWeapon\]\.name\;?/.test(code)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-067.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-067.md
index 8e1bf2336d..8a17fef7db 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-067.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-067.md
@@ -4,10 +4,9 @@ title: Part 67
challengeType: 0
---
-## Description
-
+# --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.
+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.":
@@ -16,29 +15,94 @@ let ourName = "freeCodeCamp";
let ourStr = "Hello, our name is " + ourName + ".";
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(buyWeapon.toString().match(/[\'\"\`]You now have a [\'\"\`]\s*\+\s*newWeapon\;?/));
+See description above for instructions.
+```js
+assert(
+ buyWeapon
+ .toString()
+ .match(/[\'\"\`]You now have a [\'\"\`]\s*\+\s*newWeapon\;?/)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-068.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-068.md
index acd95ed40a..06fa1a9d48 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-068.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-068.md
@@ -4,8 +4,7 @@ title: Part 68
challengeType: 0
---
-## Description
-
+# --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:
@@ -16,30 +15,90 @@ arr.push(next);
// arr now equals ["first", "second"]
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- # testString: assert(buyWeapon.toString().match(/inventory\.push\(\s*newWeapon\s*\)\;?/));
- testString: buyWeapon(), assert.deepStrictEqual(inventory, ['stick', 'dagger']);
+See description above for instructions.
+```js
+buyWeapon(), assert.deepStrictEqual(inventory, ['stick', 'dagger']);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-069.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-069.md
index fae62441d9..c668be4919 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-069.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-069.md
@@ -4,35 +4,100 @@ title: Part 69
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- assert(buyWeapon.toString().match(/text\.innerText\s*\+\=\s*[\'\"\`] In your inventory you have\: [\'\"\`]\;?/));
+See description above for instructions.
+```js
+assert(
+ buyWeapon
+ .toString()
+ .match(
+ /text\.innerText\s*\+\=\s*[\'\"\`] In your inventory you have\: [\'\"\`]\;?/
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-070.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-070.md
index bc14fad19d..ca8081102a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-070.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-070.md
@@ -4,35 +4,100 @@ title: Part 70
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- assert(buyWeapon.toString().match(/text\.innerText\s*\+\=\s*[\'\"\`] In your inventory you have\: [\'\"\`]\s*\+\s*inventory\;?/));
+See description above for instructions.
+```js
+assert(
+ buyWeapon
+ .toString()
+ .match(
+ /text\.innerText\s*\+\=\s*[\'\"\`] In your inventory you have\: [\'\"\`]\s*\+\s*inventory\;?/
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-071.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-071.md
index 312d14b9da..c02dd5d5aa 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-071.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-071.md
@@ -4,34 +4,100 @@ title: Part 71
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(buyWeapon.toString().match(/\}\s*else\s*\{\s*text\.innerText\s*\=\s*[\'\"\`]You do not have enough gold to buy a weapon\.?[\'\"\`]\;?\s*\}/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-072.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-072.md
index 1717408805..197c480a20 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-072.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-072.md
@@ -4,34 +4,105 @@ title: Part 72
challengeType: 0
---
-## Description
-
+# --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).
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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*\}/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-073.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-073.md
index 3e6a73a35f..87b069fb1f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-073.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-073.md
@@ -4,34 +4,100 @@ title: Part 73
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(buyWeapon.toString().match(/if\s*\(\s*currentWeapon\s*\<\s*weapons\.length\s*\)\s*\{\s*if\s*\(\s*gold\s*\>\=\s*30\s*\)\s*\{/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-074.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-074.md
index e5ce77a789..20f9cc6277 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-074.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-074.md
@@ -4,34 +4,100 @@ title: Part 74
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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*\{/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-075.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-075.md
index 6657c911d2..859d35e071 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-075.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-075.md
@@ -4,34 +4,100 @@ title: Part 75
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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*\}/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-076.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-076.md
index e6fb3b11bc..9d21f9c173 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-076.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-076.md
@@ -4,34 +4,100 @@ title: Part 76
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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*\}/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-077.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-077.md
index 05d1ed97c6..62c42b451b 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-077.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-077.md
@@ -4,34 +4,94 @@ title: Part 77
challengeType: 0
---
-## Description
-
+# --description--
After the `buyWeapon` function, create an empty function called `sellWeapon`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(typeof sellWeapon === 'function');
+See description above for instructions.
+```js
+assert(typeof sellWeapon === 'function');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-078.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-078.md
index 4d30da2adf..ee3929e4ff 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-078.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-078.md
@@ -4,34 +4,98 @@ title: Part 78
challengeType: 0
---
-## Description
-
+# --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.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(sellWeapon.toString().match(/if\s*\(\s*inventory\.length\s*\>\s*1\s*\)\s*\{\s*\}/));
+See description above for instructions.
+```js
+assert(
+ sellWeapon
+ .toString()
+ .match(/if\s*\(\s*inventory\.length\s*\>\s*1\s*\)\s*\{\s*\}/)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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.
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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-080.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-080.md
index 4a5b1245fa..e009a3ff39 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-080.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-080.md
@@ -4,34 +4,98 @@ title: Part 80
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.match(/if\s*\(\s*inventory\.length\s*\>\s*1\s*\)\s*\{\s*(.\s*)*let\s*currentWeapon\;?/)); # match code as toString() changes let and const to var
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-081.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-081.md
index 36a4038bbd..cd6105d661 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-081.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-081.md
@@ -4,10 +4,9 @@ title: Part 81
challengeType: 0
---
-## Description
-
+# --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.
+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:
@@ -17,29 +16,94 @@ let firstElement = arr.shift();
// arr now equals ["two", "three"] and firstElement now equals "one"
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.match(/if\s*\(\s*inventory\.length\s*\>\s*1\s*\)\s*\{\s*(.\s*)*let\s*currentWeapon\s*\=\s*inventory\.shift\(\s*\)\;?/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-082.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-082.md
index c02ace4419..648a7385e3 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-082.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-082.md
@@ -4,34 +4,96 @@ title: Part 82
challengeType: 0
---
-## Description
-
+# --description--
After the line that creates the `currentWeapon` variable, set `text.innerText` to equal `"You sold a " + currentWeapon + "."`
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: inventory = ['potato', 'carrot'], sellWeapon(), assert(text.innerText === 'You sold a potato.' && inventory[0] === 'carrot');
+See description above for instructions.
+```js
+(inventory = ['potato', 'carrot']),
+ sellWeapon(),
+ assert(text.innerText === 'You sold a potato.' && inventory[0] === 'carrot');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-083.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-083.md
index 2c8c4446b1..9452f13e83 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-083.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-083.md
@@ -4,35 +4,98 @@ title: Part 83
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- inventory = ['potato', 'carrot'], sellWeapon(), assert(text.innerText === 'You sold a potato. In your inventory you have: carrot');
+See description above for instructions.
+```js
+(inventory = ['potato', 'carrot']),
+ sellWeapon(),
+ assert(
+ text.innerText === 'You sold a potato. In your inventory you have: carrot'
+ );
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-084.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-084.md
index b2245ec45b..65630515de 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-084.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-084.md
@@ -4,34 +4,99 @@ title: Part 84
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: inventory = ['potato'], sellWeapon(), assert(inventory[0] === 'potato' && text.innerText === "Don't sell your only weapon!");
+See description above for instructions.
+```js
+(inventory = ['potato']),
+ sellWeapon(),
+ assert(
+ inventory[0] === 'potato' &&
+ text.innerText === "Don't sell your only weapon!"
+ );
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-085.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-085.md
index 832ab39088..0b810f089f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-085.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-085.md
@@ -4,37 +4,100 @@ title: Part 85
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- assert.deepStrictEqual(monsters, [{ name: "slime", level: 2, health: 15 }, {name: "fanged beast", level: 8, health: 60 }, { name: "dragon", level: 20, health: 300 }]);
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-086.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-086.md
index 5969a3aa38..592ac41123 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-086.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-086.md
@@ -4,34 +4,94 @@ title: Part 86
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(typeof goFight === 'function');
+See description above for instructions.
+```js
+assert(typeof goFight === 'function');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-087.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-087.md
index fe5a195a5b..9cab8116c5 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-087.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-087.md
@@ -4,36 +4,96 @@ title: Part 87
challengeType: 0
---
-## Description
-
+# --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();`.
+As a reminder, here is how you would call a function named `myFunc`: `myFunc();`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(fightSlime.toString().match(/fighting\s*\=\s*0\;?\s*goFight\(\s*\)\;?/));
+See description above for instructions.
+```js
+assert(fightSlime.toString().match(/fighting\s*\=\s*0\;?\s*goFight\(\s*\)\;?/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-088.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-088.md
index 6e5eb6858f..fa4308eac2 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-088.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-088.md
@@ -4,34 +4,97 @@ title: Part 88
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(fightBeast.toString().match(/fighting\s*\=\s*1\;?\s*goFight\(\s*\)\;?/) && fightDragon.toString().match(/fighting\s*\=\s*2\;?\s*goFight\(\s*\)\;?/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-089.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-089.md
index 9dce1dbcbe..3846c18d15 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-089.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-089.md
@@ -4,35 +4,104 @@ title: Part 89
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- assert.deepStrictEqual(locations[3], {name: "fight","button text": ["Attack", "Dodge", "Run"],"button functions": [attack, dodge, goTown],text: "You are fighting a monster."});
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-090.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-090.md
index be316ee5de..009659efc8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-090.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-090.md
@@ -4,34 +4,94 @@ title: Part 90
challengeType: 0
---
-## Description
-
+# --description--
At the end of the code create empty functions named `attack` and `dodge`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(typeof attack === 'function' && typeof dodge === 'function');
+See description above for instructions.
+```js
+assert(typeof attack === 'function' && typeof dodge === 'function');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-091.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-091.md
index 66b2d1dbe7..3982138218 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-091.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-091.md
@@ -4,34 +4,94 @@ title: Part 91
challengeType: 0
---
-## Description
-
+# --description--
In the `goFight` function, call the `update` function and pass it `locations[3]`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(goFight.toString().match(/update\(\s*locations\[\s*3\s*\]\s*\)\;?/));
+See description above for instructions.
+```js
+assert(goFight.toString().match(/update\(\s*locations\[\s*3\s*\]\s*\)\;?/));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-092.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-092.md
index e85f287dc7..e56e0f94fc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-092.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-092.md
@@ -4,34 +4,107 @@ title: Part 92
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert((() => { fightSlime(); return monsterHealth === 15 })() && (() => { fightBeast(); return monsterHealth === 60 })() && (() => { fightDragon(); return monsterHealth === 300 })());
+See description above for instructions.
+```js
+assert(
+ (() => {
+ fightSlime();
+ return monsterHealth === 15;
+ })() &&
+ (() => {
+ fightBeast();
+ return monsterHealth === 60;
+ })() &&
+ (() => {
+ fightDragon();
+ return monsterHealth === 300;
+ })()
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-093.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-093.md
index f4b2111f39..3ac09cd522 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-093.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-093.md
@@ -4,36 +4,100 @@ title: Part 93
challengeType: 0
---
-## Description
-
+# --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`.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(goFight.toString().match(/^\s*monsterStats\.style\.display\s*\=\s*[\'\"\`]block[\'\"\`]\;?/m));
+See description above for instructions.
+```js
+assert(
+ goFight
+ .toString()
+ .match(/^\s*monsterStats\.style\.display\s*\=\s*[\'\"\`]block[\'\"\`]\;?/m)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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.
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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-095.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-095.md
index e3849adc30..0871f8ac43 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-095.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-095.md
@@ -4,34 +4,94 @@ title: Part 95
challengeType: 0
---
-## Description
-
+# --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`.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: fightDragon(), attack(), assert(text.innerText === 'The dragon attacks.');
+See description above for instructions.
+```js
+fightDragon(), attack(), assert(text.innerText === 'The dragon attacks.');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-096.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-096.md
index 004e5332eb..1bebe449c9 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-096.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-096.md
@@ -4,34 +4,99 @@ title: Part 96
challengeType: 0
---
-## Description
-
+# --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`.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: currentWeapon = 3, fightDragon(), attack(), assert(text.innerText === 'The dragon attacks. You attack it with your sword.');
+See description above for instructions.
+```js
+(currentWeapon = 3),
+ fightDragon(),
+ attack(),
+ assert(
+ text.innerText === 'The dragon attacks. You attack it with your sword.'
+ );
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-097.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-097.md
index cf72b1e421..4359dc7dd3 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-097.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-097.md
@@ -4,34 +4,94 @@ title: Part 97
challengeType: 0
---
-## Description
-
+# --description--
Next, set `health` to equal `health` minus the monster's level. You can get the monster's level with `monsters[fighting].level`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: health = 50, fightDragon(), attack(), assert(health === 30);
+See description above for instructions.
+```js
+(health = 50), fightDragon(), attack(), assert(health === 30);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-098.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-098.md
index 9cdb504a6a..fe35c8c9ff 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-098.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-098.md
@@ -4,34 +4,94 @@ title: Part 98
challengeType: 0
---
-## Description
-
+# --description--
Set `monsterHealth` to `monsterHealth` minus the power of the current weapon (`weapons[currentWeapon].power`).
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: fightDragon(), monsterHealth = 20, attack(), assert(monsterHealth === 15);
+See description above for instructions.
+```js
+fightDragon(), (monsterHealth = 20), attack(), assert(monsterHealth === 15);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-099.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-099.md
index afeaa03e83..ca1f7a8bb0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-099.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-099.md
@@ -4,36 +4,100 @@ title: Part 99
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: xp = 1, fightDragon(), monsterHealth = 20, attack(), assert(monsterHealth === 14);
+See description above for instructions.
+```js
+(xp = 1),
+ fightDragon(),
+ (monsterHealth = 20),
+ attack(),
+ assert(monsterHealth === 14);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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.
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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-101.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-101.md
index da7ca1bd08..a1d2ffd513 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-101.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-101.md
@@ -4,34 +4,98 @@ title: Part 101
challengeType: 0
---
-## Description
-
+# --description--
Check if health is less than or equal to zero. If it is, call the `lose()` function.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(attack.toString().match(/^\s*if\s*\(\s*health\s*\<\=\s*0\s*\)\s*\{\s*lose\(\s*\);?\s*\}/m));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-102.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-102.md
index e654ccfe5b..96612bd30d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-102.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-102.md
@@ -4,10 +4,9 @@ title: Part 102
challengeType: 0
---
-## Description
-
+# --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.
+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`:
@@ -21,29 +20,96 @@ if (num > 15) {
}
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-103.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-103.md
index 9061a39735..0cf50cd0b6 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-103.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-103.md
@@ -4,34 +4,94 @@ title: Part 103
challengeType: 0
---
-## Description
-
+# --description--
At the end of the code add two empty functions named `defeatMonster` and `lose`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(typeof defeatMonster === 'function' && typeof lose === 'function');
+See description above for instructions.
+```js
+assert(typeof defeatMonster === 'function' && typeof lose === 'function');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-104.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-104.md
index 64575797fb..9a75586e1f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-104.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-104.md
@@ -4,34 +4,96 @@ title: Part 104
challengeType: 0
---
-## Description
-
+# --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`.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: fightDragon(), dodge(), assert(text.innerText === 'You dodge the attack from the dragon.');
+See description above for instructions.
+```js
+fightDragon(),
+ dodge(),
+ assert(text.innerText === 'You dodge the attack from the dragon.');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-105.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-105.md
index fbea3db15c..c838d4a6f6 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-105.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-105.md
@@ -4,36 +4,96 @@ title: Part 105
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: gold = 10, fightSlime(), defeatMonster(), assert(gold === 23);
+See description above for instructions.
+```js
+(gold = 10), fightSlime(), defeatMonster(), assert(gold === 23);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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.
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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-107.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-107.md
index d3823e41ee..6562166290 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-107.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-107.md
@@ -4,34 +4,98 @@ title: Part 107
challengeType: 0
---
-## Description
-
+# --description--
Now set the `innerText` properties of `goldText` and `xpText` to the updated values.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: xp = 10, gold = 10, fightSlime(), defeatMonster(), assert(goldText.innerText === '23' && xpText.innerText === '12');
+See description above for instructions.
+```js
+(xp = 10),
+ (gold = 10),
+ fightSlime(),
+ defeatMonster(),
+ assert(goldText.innerText === '23' && xpText.innerText === '12');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-108.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-108.md
index 65402f9fdc..a2f980def0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-108.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-108.md
@@ -4,34 +4,96 @@ title: Part 108
challengeType: 0
---
-## Description
-
+# --description--
Finish the `defeatMonster` function by calling the `update()` function and pass in `locations[4]`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(defeatMonster.toString().match(/^\s*update\(\s*locations\[\s*4\s*\]\s*\)/m));
+See description above for instructions.
+```js
+assert(
+ defeatMonster.toString().match(/^\s*update\(\s*locations\[\s*4\s*\]\s*\)/m)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-109.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-109.md
index 2047b40b4a..791937220f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-109.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-109.md
@@ -4,35 +4,104 @@ title: Part 109
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- 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."});
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-110.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-110.md
index 06c4e12c44..f6df8cf64e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-110.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-110.md
@@ -4,35 +4,104 @@ title: Part 110
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- 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.'});
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-111.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-111.md
index 7979a7d4ef..5fea280f6e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-111.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-111.md
@@ -4,35 +4,102 @@ title: Part 111
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- assert.deepStrictEqual(locations[5], {name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"],"button functions": [restart, restart, restart],text: "You die. ☠️"});
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-112.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-112.md
index a93fe2fb0e..563d027232 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-112.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-112.md
@@ -4,34 +4,97 @@ title: Part 112
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: fightSlime(), defeatMonster(), assert(monsterStats.style.display === 'none');
+See description above for instructions.
+```js
+fightSlime(), defeatMonster(), assert(monsterStats.style.display === 'none');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-113.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-113.md
index 61c6bf8854..074fe1fc4e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-113.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-113.md
@@ -4,34 +4,97 @@ title: Part 113
challengeType: 0
---
-## Description
-
+# --description--
In the `lose` function, call the `update` function and pass in `locations[5]`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: update(locations[0]), lose(), assert(text.innerText === 'You die. ☠️');
+See description above for instructions.
+```js
+update(locations[0]), lose(), assert(text.innerText === 'You die. ☠️');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-114.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-114.md
index 57ebe95731..5469fa147e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-114.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-114.md
@@ -4,36 +4,113 @@ title: Part 114
challengeType: 0
---
-## Description
-
+# --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.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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."');
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-115.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-115.md
index a6b4de8fea..2fe9867a7d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-115.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-115.md
@@ -4,34 +4,100 @@ title: Part 115
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-116.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-116.md
index f47c9189dd..5fa75e042a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-116.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-116.md
@@ -4,10 +4,9 @@ title: Part 116
challengeType: 0
---
-## Description
-
+# --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;`.
+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:
@@ -23,29 +22,96 @@ if (age >= 18) {
age >= 18 ? adultFunction() : kidFunction();
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-117.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-117.md
index 6ec4315d64..6844f73b18 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-117.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-117.md
@@ -4,34 +4,94 @@ title: Part 117
challengeType: 0
---
-## Description
-
+# --description--
After the `lose` function, create a function called `winGame`. Inside the `winGame` function, call the `update` function and pass in `locations[6]`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(winGame.toString().replace(/\s/g, '').includes('update(locations[6])'));
+See description above for instructions.
+```js
+assert(winGame.toString().replace(/\s/g, '').includes('update(locations[6])'));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-118.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-118.md
index 8c194b1285..75c4811a9e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-118.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-118.md
@@ -4,35 +4,99 @@ title: Part 118
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- 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! 🎉" });
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-119.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-119.md
index f54acedcf9..bdb74c89c7 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-119.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-119.md
@@ -4,36 +4,101 @@ title: Part 119
challengeType: 0
---
-## Description
-
+# --description--
-The game could be complete now, but let's make it more interesting.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(attack.toString().replace(/\s/g, '').includes('health-=getMonsterAttackValue(monsters[fighting].level'));
+See description above for instructions.
+```js
+assert(
+ attack
+ .toString()
+ .replace(/\s/g, '')
+ .includes('health-=getMonsterAttackValue(monsters[fighting].level')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-120.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-120.md
index baa929b748..3c26f31aca 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-120.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-120.md
@@ -4,34 +4,97 @@ title: Part 120
challengeType: 0
---
-## Description
-
+# --description--
Under the `attack` function, create a function with name `getMonsterAttackValue` that takes `level` as a parameter.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(getMonsterAttackValue.toString().replace(/\s/g, '') === 'functiongetMonsterAttackValue(level){}');
+See description above for instructions.
+```js
+assert(
+ getMonsterAttackValue.toString().replace(/\s/g, '') ===
+ 'functiongetMonsterAttackValue(level){}'
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-121.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-121.md
index 5052d29a4d..a5a124a07c 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-121.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-121.md
@@ -4,34 +4,99 @@ title: Part 121
challengeType: 0
---
-## Description
-
+# --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))`.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(getMonsterAttackValue.toString().replace(/\s/g, '').includes('varhit=level*5-Math.floor(Math.random()*xp)'));
+See description above for instructions.
+```js
+assert(
+ getMonsterAttackValue
+ .toString()
+ .replace(/\s/g, '')
+ .includes('varhit=level*5-Math.floor(Math.random()*xp)')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-122.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-122.md
index 0b56d25266..36af249a61 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-122.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-122.md
@@ -4,36 +4,101 @@ title: Part 122
challengeType: 0
---
-## Description
-
+# --description--
-Log the value of `hit` to the console to use in debugging.
+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);`.
+Here is how to log the value of `num` to the console: `console.log(num);`.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(getMonsterAttackValue.toString().replace(/\s/g, '').includes('console.log(hit)'));
+See description above for instructions.
+```js
+assert(
+ getMonsterAttackValue
+ .toString()
+ .replace(/\s/g, '')
+ .includes('console.log(hit)')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-123.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-123.md
index a2fcfebb75..dc2bc0a719 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-123.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-123.md
@@ -4,10 +4,9 @@ title: Part 123
challengeType: 0
---
-## Description
-
+# --description--
-Now return `hit` from the `getMonsterAttackValue` function. The return value of this function is used in the `attack` function.
+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:
@@ -20,29 +19,92 @@ function plusThree(num) {
const answer = plusThree(5); // 8
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(getMonsterAttackValue.toString().replace(/\s/g, '').includes('returnhit'));
+See description above for instructions.
+```js
+assert(
+ getMonsterAttackValue.toString().replace(/\s/g, '').includes('returnhit')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-124.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-124.md
index e8090562c3..81f07c9b08 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-124.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-124.md
@@ -4,14 +4,13 @@ title: Part 124
challengeType: 0
---
-## Description
-
+# --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:
+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) {
@@ -19,29 +18,95 @@ function applyDiscount(tickets) {
}
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(getMonsterAttackValue.toString().replace(/\s/g, '').includes('returnhit>0?hit:0'));
+See description above for instructions.
+```js
+assert(
+ getMonsterAttackValue
+ .toString()
+ .replace(/\s/g, '')
+ .includes('returnhit>0?hit:0')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-125.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-125.md
index ac5dd97d3c..6ad4029410 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-125.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-125.md
@@ -4,10 +4,9 @@ title: Part 125
challengeType: 0
---
-## Description
-
+# --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()`.
+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:
@@ -17,29 +16,90 @@ if (isTrue()) {
}
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(attack.toString().replace(/\s/g, '').includes('if(isMonsterHit()){}'));
+See description above for instructions.
+```js
+assert(attack.toString().replace(/\s/g, '').includes('if(isMonsterHit()){}'));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-126.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-126.md
index 2b68e3fd2c..ee110c16aa 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-126.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-126.md
@@ -4,10 +4,9 @@ title: Part 126
challengeType: 0
---
-## Description
-
+# --description--
-In the `attack` function, move the line `monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1;` into the `if` block.
+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:
@@ -17,29 +16,97 @@ if (isTrue()) {
}
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(attack.toString().replace(/\s/g, '').match(/if\(isMonsterHit\(\)\)\{monsterHealth\-\=weapons\[currentWeapon\]\.power\+Math\.floor\(Math\.random\(\)\*xp\)\+1;?\}/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-127.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-127.md
index 205a62986b..827e909a24 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-127.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-127.md
@@ -4,34 +4,101 @@ title: Part 127
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(attack.toString().replace(/\s/g, '').match(/if\(isMonsterHit\(\)\)\{monsterHealth\-\=weapons\[currentWeapon\]\.power\+Math\.floor\(Math\.random\(\)\*xp\)\+1;?\}else\{text\.innerText\+\=[\'\"\`]Youmiss.[\'\"\`]\;?\}/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-128.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-128.md
index 0cbe27caba..700a5892ae 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-128.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-128.md
@@ -4,8 +4,7 @@ title: Part 128
challengeType: 0
---
-## Description
-
+# --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`.
@@ -17,29 +16,99 @@ function flipHeads() {
}
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(isMonsterHit.toString().replace(/\s/g, '').includes('returnMath.random()>.2') || isMonsterHit.toString().replace(/\s/g, '').includes('returnMath.random()>0.2'));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-129.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-129.md
index b825987ddd..982b9e405e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-129.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-129.md
@@ -4,36 +4,105 @@ title: Part 129
challengeType: 0
---
-## Description
-
+# --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.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(isMonsterHit.toString().replace(/\s/g, '').includes('returnMath.random()>.2||health<20') || isMonsterHit.toString().replace(/\s/g, '').includes('returnMath.random()>0.2||health<20'));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-130.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-130.md
index e559b64a71..7f9a72c042 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-130.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-130.md
@@ -4,34 +4,100 @@ title: Part 130
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(attack.toString().replace(/\s/g, '').includes('if(Math.random()<=.1){}') || isMonsterHit.toString().replace(/\s/g, '').includes('if(Math.random()<=0.1){}'));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-131.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-131.md
index 6e3c707839..99ce09e757 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-131.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-131.md
@@ -4,10 +4,9 @@ title: Part 131
challengeType: 0
---
-## Description
-
+# --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 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:
@@ -17,29 +16,103 @@ console.log("I bought " + shoppingList.pop() + "."); // Logs "I bought cereal."
// shoppingList now equals ["milk", "apples"]
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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\.\"\)\;?\}/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-132.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-132.md
index 0964b9fe18..b8d7c6f081 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-132.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-132.md
@@ -4,34 +4,101 @@ title: Part 132
challengeType: 0
---
-## Description
-
+# --description--
Decrement the value of `currentWeapon` using `--`. For example, say `num` equals 5. After running `num--`, `num` now equals 4.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(attack.toString().replace(/\s/g, '').match(/if\(Math\.random\(\)\<\=0?\.1\)\{text\.innerText\+\=\"Your\"\+inventory\.pop\(\)\+\"breaks\.\"\;?currentWeapon--\;?\}/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-133.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-133.md
index 35b725d591..aaec00f8b9 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-133.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-133.md
@@ -4,12 +4,11 @@ title: Part 133
challengeType: 0
---
-## Description
-
+# --description--
-We don't want a player's only weapon to break.
+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.
+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.
@@ -19,29 +18,97 @@ if (firstName === "Quincy" && lastName !== "Larson") {
}
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(attack.toString().replace(/\s/g, '').match(/if\(Math\.random\(\)\<\=0?\.1\&\&inventory\.length\!\=\=1\)\{text\.innerText\+\=\"Your\"\+inventory\.pop\(\)\+\"breaks\.\"\;?currentWeapon--\;?\}/));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-134.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-134.md
index edd04e7be1..51a7037eca 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-134.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-134.md
@@ -4,36 +4,101 @@ title: Part 134
challengeType: 0
---
-## Description
-
+# --description--
-The only thing left to add is a mini-game easter egg (a hidden feature).
+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.
+Add a new function called `easterEgg` that calls the `update` function and passes in `locations[7]` as an argument.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(easterEgg.toString().replace(/\s/g, '').match(/functioneasterEgg\(\)\{(return)?update\(locations\[7\]\)\;?}/));
+See description above for instructions.
+```js
+assert(
+ easterEgg
+ .toString()
+ .replace(/\s/g, '')
+ .match(/functioneasterEgg\(\)\{(return)?update\(locations\[7\]\)\;?}/)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-135.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-135.md
index 353b7ac4a4..ff1c7f030e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-135.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-135.md
@@ -4,37 +4,105 @@ title: Part 135
challengeType: 0
---
-## Description
-
+# --description--
-Add a new object to the `locations` array.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- 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!"});
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-136.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-136.md
index 585c1c00a8..d68ddf09d8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-136.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-136.md
@@ -4,36 +4,102 @@ title: Part 136
challengeType: 0
---
-## Description
-
+# --description--
-At the end of the code, add two new functions named `pickTwo` and `pickEight`.
+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.
+Inside each function call the `pick()` function. Pass either "2" or "8" as arguments to `pick` depending on the function name.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert( pickTwo.toString().replace(/\s/g, '').includes('pick(2)') && pickEight.toString().replace(/\s/g, '').includes('pick(8)') );
+See description above for instructions.
+```js
+assert(
+ pickTwo.toString().replace(/\s/g, '').includes('pick(2)') &&
+ pickEight.toString().replace(/\s/g, '').includes('pick(8)')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-137.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-137.md
index 44bd3d8b25..3ae1447830 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-137.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-137.md
@@ -4,34 +4,94 @@ title: Part 137
challengeType: 0
---
-## Description
-
+# --description--
Add a `pick` function with a parameter named "guess".
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(pick.toString().replace(/\s/g, '').includes('functionpick(guess){}'));
+See description above for instructions.
+```js
+assert(pick.toString().replace(/\s/g, '').includes('functionpick(guess){}'));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-138.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-138.md
index de7ffb8f21..727c90d3a7 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-138.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-138.md
@@ -4,34 +4,99 @@ title: Part 138
challengeType: 0
---
-## Description
-
+# --description--
Inside `pick`, use `let` to initialize a variable named "numbers" and set it to an empty array.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(pick.toString().replace(/\s/g, '').match(/functionpick\(guess\)\{varnumbers\=\[\]\;?\}/));
+See description above for instructions.
+```js
+assert(
+ pick
+ .toString()
+ .replace(/\s/g, '')
+ .match(/functionpick\(guess\)\{varnumbers\=\[\]\;?\}/)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-139.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-139.md
index 4054066b11..ab1e56c84c 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-139.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-139.md
@@ -4,10 +4,9 @@ title: Part 139
challengeType: 0
---
-## Description
-
+# --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.
+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.
@@ -21,29 +20,97 @@ while(i < 5) {
// ourArray now equals [0,1,2,3,4]
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(pick.toString().replace(/\s/g, '').includes('while(numbers.length<10){if(_LPC++%2000===0&&Date.now()-_LP>1500){')); # Take loop protect into account
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-140.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-140.md
index 3bb08731ad..6de00f203b 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-140.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-140.md
@@ -4,34 +4,99 @@ title: Part 140
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(pick.toString().replace(/\s/g, '').includes('numbers.push(Math.floor(Math.random()*11));}')); # Take loop protect into account
+See description above for instructions.
+```js
+assert(
+ pick
+ .toString()
+ .replace(/\s/g, '')
+ .includes('numbers.push(Math.floor(Math.random()*11));}')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-141.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-141.md
index 0cd28c4984..1562e3d493 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-141.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-141.md
@@ -4,34 +4,95 @@ title: Part 141
challengeType: 0
---
-## Description
-
+# --description--
-After the `while` loop, set `text.innerText` to equal "You picked [guess]. Here are the random numbers:". Replace [guess] with the actual guess.
+After the `while` loop, set `text.innerText` to equal "You picked \[guess]. Here are the random numbers:". Replace \[guess] with the actual guess.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: pickTwo(), assert(text.innerText === 'You picked 2. Here are the random numbers:');
+See description above for instructions.
+```js
+pickTwo(),
+ assert(text.innerText === 'You picked 2. Here are the random numbers:');
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-142.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-142.md
index 94729a2b31..33635c68e8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-142.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-142.md
@@ -4,34 +4,107 @@ title: Part 142
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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");'));
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-143.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-143.md
index 00f5ef670e..7e9f98e52f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-143.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-143.md
@@ -4,8 +4,7 @@ title: Part 143
challengeType: 0
---
-## Description
-
+# --description--
A `for` loop runs "for" a specific number of times.
@@ -17,29 +16,90 @@ for (let x = 1; x < 5; x++) {
}
```
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(pick.toString().replace(/\s/g, '').includes('for(varx=1;x<5;x++){')); # Also test for automatic loop protection
+See description above for instructions.
+```js
+assert(pick.toString().replace(/\s/g, '').includes('for(varx=1;x<5;x++){'));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-144.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-144.md
index f3812ef535..ae195e21ae 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-144.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-144.md
@@ -4,38 +4,98 @@ title: Part 144
challengeType: 0
---
-## Description
-
+# --description--
-For loops are declared with three optional expressions separated by semicolons: `for ([initialization]; [condition]; [final-expression])`.
+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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(pick.toString().replace(/\s/g, '').includes('for(vari=0;x<5;x++){')); # Also test for automatic loop protection
+See description above for instructions.
+```js
+assert(pick.toString().replace(/\s/g, '').includes('for(vari=0;x<5;x++){'));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-145.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-145.md
index 03600b54c0..3e0baa0c73 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-145.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-145.md
@@ -4,36 +4,96 @@ title: Part 145
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(pick.toString().replace(/\s/g, '').includes('for(vari=0;i<10;x++){')); # Also test for automatic loop protection
+See description above for instructions.
+```js
+assert(pick.toString().replace(/\s/g, '').includes('for(vari=0;i<10;x++){'));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-146.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-146.md
index baf710243a..6ccab92a04 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-146.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-146.md
@@ -4,36 +4,96 @@ title: Part 146
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(pick.toString().replace(/\s/g, '').includes('for(vari=0;i<10;i++){')); # Also test for automatic loop protection
+See description above for instructions.
+```js
+assert(pick.toString().replace(/\s/g, '').includes('for(vari=0;i<10;i++){'));
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-147.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-147.md
index 02d0c1f05b..6bb65bebbf 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-147.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-147.md
@@ -4,34 +4,99 @@ title: Part 147
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert( pick.toString().replace(/\s/g, '').includes('text.innerText+=numbers[i]+"\\n";}}') ); # Also test for automatic loop protection
+See description above for instructions.
+```js
+assert(
+ pick
+ .toString()
+ .replace(/\s/g, '')
+ .includes('text.innerText+=numbers[i]+"\\n";}}')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-148.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-148.md
index ab49fb9509..9f3d846df8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-148.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-148.md
@@ -4,36 +4,101 @@ title: Part 148
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert( pick.toString().replace(/\s/g, '').includes('if(numbers.indexOf(guess)!==-1){}') );
+See description above for instructions.
+```js
+assert(
+ pick
+ .toString()
+ .replace(/\s/g, '')
+ .includes('if(numbers.indexOf(guess)!==-1){}')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-149.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-149.md
index eb653fff6f..57fd794ef5 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-149.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-149.md
@@ -4,34 +4,101 @@ title: Part 149
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: 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;') );
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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.
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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-151.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-151.md
index 60720118c4..8126352833 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-151.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-151.md
@@ -4,34 +4,101 @@ title: Part 151
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert( pick.toString().replace(/\s/g, '').includes('else{text.innerText+="Wrong!Youlose10health!";health-=10;healthText.innerText=health;if(health<=0){lose();}}') );
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-152.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-152.md
index b0c4d2c87d..9145c12021 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-152.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-152.md
@@ -4,35 +4,104 @@ title: Part 152
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: |
- 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.'});
+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--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-153.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-153.md
index b92304bb65..e7230f773d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-153.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript-rpg-game/part-153.md
@@ -4,34 +4,94 @@ title: Part 153
challengeType: 0
---
-## Description
-
+# --description--
Congratulations! You are finished! Now try out the game.
-
+# --hints--
-## Instructions
-
+See description above for instructions.
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: ''
+```js
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
+```html
+
+
+
+
+ RPG - Dragon Repeller
+
+
+
+
+
+ XP: 0
+ Health: 100
+ Gold: 50
+
+
+ Go to store
+ Go to cave
+ Fight dragon
+
+
+ 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.
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 Test
-
-
-```html
-
-
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md
index ce54e3c516..565c6b0250 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md
@@ -6,12 +6,15 @@ videoUrl: 'https://scrimba.com/c/cBZQbTz'
forumTopicId: 16158
---
-## Description
-
+# --description--
+
We can access the data inside arrays using indexes.
-Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array has an index of 0.
-
-Example
+
+Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array has an index of `0`.
+
+
+
+**Example**
```js
var array = [50,60,70];
@@ -19,62 +22,67 @@ array[0]; // equals 50
var data = array[1]; // equals 60
```
-Note There shouldn't be any spaces between the array name and the square brackets, like array [0]. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
-
+**Note**
+There shouldn't be any spaces between the array name and the square brackets, like `array [0]`. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
-## Instructions
-
-Create a variable called myData and set it to equal the first value of myArray using bracket notation.
-
+# --instructions--
-## Tests
-
+Create a variable called `myData` and set it to equal the first value of `myArray` using bracket notation.
-```yml
-tests:
- - text: The variable myData should equal the first value of myArray.
- testString: assert((function(){if(typeof myArray !== 'undefined' && typeof myData !== 'undefined' && myArray[0] === myData){return true;}else{return false;}})());
- - text: The data in variable myArray should be accessed using bracket notation.
- testString: assert((function(){if(code.match(/\s*=\s*myArray\[0\]/g)){return true;}else{return false;}})());
+# --hints--
+The variable `myData` should equal the first value of `myArray`.
+
+```js
+assert(
+ (function () {
+ if (
+ typeof myArray !== 'undefined' &&
+ typeof myData !== 'undefined' &&
+ myArray[0] === myData
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })()
+);
```
-
+The data in variable `myArray` should be accessed using bracket notation.
-## Challenge Seed
-
+```js
+assert(
+ (function () {
+ if (code.match(/\s*=\s*myArray\[0\]/g)) {
+ return true;
+ } else {
+ return false;
+ }
+ })()
+);
+```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [50,60,70];
var myData = myArray[0];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md
index cbd2f8d3b9..0f25ac386d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/ckND4Cq'
forumTopicId: 16159
---
-## Description
-
-One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of brackets refers to the entries in the outer-most (the first level) array, and each additional pair of brackets refers to the next level of entries inside.
-Example
+# --description--
+
+One way to think of a multi-dimensional array, is as an *array of arrays*. When you use brackets to access your array, the first set of brackets refers to the entries in the outer-most (the first level) array, and each additional pair of brackets refers to the next level of entries inside.
+
+**Example**
```js
var arr = [
@@ -23,32 +24,36 @@ arr[3][0]; // equals [10,11,12]
arr[3][0][1]; // equals 11
```
-Note There shouldn't be any spaces between the array name and the square brackets, like `array [0][0]` and even this `array [0] [0]` is not allowed. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
-
+**Note**
+There shouldn't be any spaces between the array name and the square brackets, like `array [0][0]` and even this `array [0] [0]` is not allowed. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
-## Instructions
-
-Using bracket notation select an element from myArray such that myData is equal to 8.
-
+# --instructions--
-## Tests
-
+Using bracket notation select an element from `myArray` such that `myData` is equal to `8`.
-```yml
-tests:
- - text: myData should be equal to 8.
- testString: assert(myData === 8);
- - text: You should be using bracket notation to read the correct value from myArray.
- testString: assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code)));
+# --hints--
+`myData` should be equal to `8`.
+
+```js
+assert(myData === 8);
```
-
+You should be using bracket notation to read the correct value from `myArray`.
-## Challenge Seed
-
+```js
+assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code)));
+```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [[1,2,3],[4,5,6], [7,8,9], [[10,11,12], 13, 14]];
var myData = myArray[2][1];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md
index b04110b4a1..0e2b133623 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cLeGDtZ'
forumTopicId: 16160
---
-## Description
-
+# --description--
+
As we have seen in earlier examples, objects can contain both nested objects and nested arrays. Similar to accessing nested objects, Array bracket notation can be chained to access nested arrays.
+
Here is an example of how to access a nested array:
```js
@@ -34,31 +35,38 @@ ourPets[0].names[1]; // "Fluffy"
ourPets[1].names[0]; // "Spot"
```
-
+# --instructions--
-## Instructions
-
-Retrieve the second tree from the variable myPlants using object dot and array bracket notation.
-
+Retrieve the second tree from the variable `myPlants` using object dot and array bracket notation.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: secondTree should equal "pine".
- testString: assert(secondTree === "pine");
- - text: Your code should use dot and bracket notation to access myPlants.
- testString: assert(/=\s*myPlants\[1\].list\[1\]/.test(code));
+`secondTree` should equal "pine".
+```js
+assert(secondTree === 'pine');
```
-
+Your code should use dot and bracket notation to access `myPlants`.
-## Challenge Seed
-
+```js
+assert(/=\s*myPlants\[1\].list\[1\]/.test(code));
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(x) {
+ if(typeof x != 'undefined') {
+ return "secondTree = " + x;
+ }
+ return "secondTree is undefined";
+})(secondTree);
+```
+
+## --seed-contents--
```js
// Setup
@@ -84,31 +92,9 @@ var myPlants = [
// Only change code below this line
var secondTree = ""; // Change this line
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myPlants = [
@@ -134,5 +120,3 @@ var myPlants = [
var secondTree = myPlants[1].list[1];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md
index 7c354725f3..43cb508ad2 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cRnRnfa'
forumTopicId: 16161
---
-## Description
-
+# --description--
+
The sub-properties of objects can be accessed by chaining together the dot or bracket notation.
+
Here is a nested object:
```js
@@ -28,31 +29,38 @@ ourStorage.cabinet["top drawer"].folder2; // "secrets"
ourStorage.desk.drawer; // "stapler"
```
-
+# --instructions--
-## Instructions
-
-Access the myStorage object and assign the contents of the glove box property to the gloveBoxContents variable. Use dot notation for all properties where possible, otherwise use bracket notation.
-
+Access the `myStorage` object and assign the contents of the `glove box` property to the `gloveBoxContents` variable. Use dot notation for all properties where possible, otherwise use bracket notation.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: gloveBoxContents should equal "maps".
- testString: assert(gloveBoxContents === "maps");
- - text: Your code should use dot and bracket notation to access myStorage.
- testString: assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
+`gloveBoxContents` should equal "maps".
+```js
+assert(gloveBoxContents === 'maps');
```
-
+Your code should use dot and bracket notation to access `myStorage`.
-## Challenge Seed
-
+```js
+assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(x) {
+ if(typeof x != 'undefined') {
+ return "gloveBoxContents = " + x;
+ }
+ return "gloveBoxContents is undefined";
+})(gloveBoxContents);
+```
+
+## --seed-contents--
```js
// Setup
@@ -69,31 +77,9 @@ var myStorage = {
};
var gloveBoxContents = undefined; // Change this line
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myStorage = {
@@ -109,5 +95,3 @@ var myStorage = {
};
var gloveBoxContents = myStorage.car.inside["glove box"];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md
index 331e0a4ef7..159cdb42e6 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/c/cBvmEHP'
forumTopicId: 16163
---
-## Description
-
-The second way to access the properties of an object is bracket notation ([]). If the property of the object you are trying to access has a space in its name, you will need to use bracket notation.
+# --description--
+
+The second way to access the properties of an object is bracket notation (`[]`). If the property of the object you are trying to access has a space in its name, you will need to use bracket notation.
+
However, you can still use bracket notation on object properties without spaces.
+
Here is a sample of using bracket notation to read an object's property:
```js
@@ -24,37 +26,52 @@ myObj["NoSpace"]; // USS Enterprise
```
Note that property names with spaces in them must be in quotes (single or double).
-
-## Instructions
-
-Read the values of the properties "an entree" and "the drink" of testObj using bracket notation and assign them to entreeValue and drinkValue respectively.
-
+# --instructions--
-## Tests
-
+Read the values of the properties `"an entree"` and `"the drink"` of `testObj` using bracket notation and assign them to `entreeValue` and `drinkValue` respectively.
-```yml
-tests:
- - text: entreeValue should be a string
- testString: assert(typeof entreeValue === 'string' );
- - text: The value of entreeValue should be "hamburger"
- testString: assert(entreeValue === 'hamburger' );
- - text: drinkValue should be a string
- testString: assert(typeof drinkValue === 'string' );
- - text: The value of drinkValue should be "water"
- testString: assert(drinkValue === 'water' );
- - text: You should use bracket notation twice
- testString: assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1);
+# --hints--
+`entreeValue` should be a string
+
+```js
+assert(typeof entreeValue === 'string');
```
-
+The value of `entreeValue` should be `"hamburger"`
-## Challenge Seed
-
+```js
+assert(entreeValue === 'hamburger');
+```
-
+`drinkValue` should be a string
+
+```js
+assert(typeof drinkValue === 'string');
+```
+
+The value of `drinkValue` should be `"water"`
+
+```js
+assert(drinkValue === 'water');
+```
+
+You should use bracket notation twice
+
+```js
+assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(a,b) { return "entreeValue = '" + a + "', drinkValue = '" + b + "'"; })(entreeValue,drinkValue);
+```
+
+## --seed-contents--
```js
// Setup
@@ -70,23 +87,7 @@ var entreeValue = testObj; // Change this line
var drinkValue = testObj; // Change this line
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var testObj = {
@@ -97,5 +98,3 @@ var testObj = {
var entreeValue = testObj["an entree"];
var drinkValue = testObj['the drink'];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md
index adbfe55ae8..4791968cc1 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md
@@ -6,11 +6,13 @@ videoUrl: 'https://scrimba.com/c/cGryJs8'
forumTopicId: 16164
---
-## Description
-
-There are two ways to access the properties of an object: dot notation (.) and bracket notation ([]), similar to an array.
+# --description--
+
+There are two ways to access the properties of an object: dot notation (`.`) and bracket notation (`[]`), similar to an array.
+
Dot notation is what you use when you know the name of the property you're trying to access ahead of time.
-Here is a sample of using dot notation (.) to read an object's property:
+
+Here is a sample of using dot notation (`.`) to read an object's property:
```js
var myObj = {
@@ -21,37 +23,51 @@ var prop1val = myObj.prop1; // val1
var prop2val = myObj.prop2; // val2
```
-
+# --instructions--
-## Instructions
-
-Read in the property values of testObj using dot notation. Set the variable hatValue equal to the object's property hat and set the variable shirtValue equal to the object's property shirt.
-
+Read in the property values of `testObj` using dot notation. Set the variable `hatValue` equal to the object's property `hat` and set the variable `shirtValue` equal to the object's property `shirt`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: hatValue should be a string
- testString: assert(typeof hatValue === 'string' );
- - text: The value of hatValue should be "ballcap"
- testString: assert(hatValue === 'ballcap' );
- - text: shirtValue should be a string
- testString: assert(typeof shirtValue === 'string' );
- - text: The value of shirtValue should be "jersey"
- testString: assert(shirtValue === 'jersey' );
- - text: You should use dot notation twice
- testString: assert(code.match(/testObj\.\w+/g).length > 1);
+`hatValue` should be a string
+```js
+assert(typeof hatValue === 'string');
```
-
+The value of `hatValue` should be `"ballcap"`
-## Challenge Seed
-
+```js
+assert(hatValue === 'ballcap');
+```
-
+`shirtValue` should be a string
+
+```js
+assert(typeof shirtValue === 'string');
+```
+
+The value of `shirtValue` should be `"jersey"`
+
+```js
+assert(shirtValue === 'jersey');
+```
+
+You should use dot notation twice
+
+```js
+assert(code.match(/testObj\.\w+/g).length > 1);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(a,b) { return "hatValue = '" + a + "', shirtValue = '" + b + "'"; })(hatValue,shirtValue);
+```
+
+## --seed-contents--
```js
// Setup
@@ -67,23 +83,7 @@ var hatValue = testObj; // Change this line
var shirtValue = testObj; // Change this line
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var testObj = {
@@ -95,5 +95,3 @@ var testObj = {
var hatValue = testObj.hat;
var shirtValue = testObj.shirt;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md
index 3a2fb7fa55..95ac42970a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cnQyKur'
forumTopicId: 16165
---
-## Description
-
+# --description--
+
Another use of bracket notation on objects is to access a property which is stored as the value of a variable. This can be very useful for iterating through an object's properties or when accessing a lookup table.
+
Here is an example of using a variable to access a property:
```js
@@ -34,40 +35,59 @@ var someProp = propPrefix("Name"); // someProp now holds the value 'propName'
console.log(someObj[someProp]); // "John"
```
-Note that we do not use quotes around the variable name when using it to access the property because we are using the value of the variable, not the name.
-
+Note that we do *not* use quotes around the variable name when using it to access the property because we are using the *value* of the variable, not the *name*.
-## Instructions
-
-Set the playerNumber variable to 16. Then, use the variable to look up the player's name and assign it to player.
-
+# --instructions--
-## Tests
-
+Set the `playerNumber` variable to `16`. Then, use the variable to look up the player's name and assign it to `player`.
-```yml
-tests:
- - text: playerNumber should be a number
- testString: assert(typeof playerNumber === 'number');
- - text: The variable player should be a string
- testString: assert(typeof player === 'string');
- - text: The value of player should be "Montana"
- testString: assert(player === 'Montana');
- - text: You should use bracket notation to access testObj
- testString: assert(/testObj\s*?\[.*?\]/.test(code));
- - text: You should not assign the value Montana to the variable player directly.
- testString: assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi));
- - text: You should be using the variable playerNumber in your bracket notation
- testString: assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code));
+# --hints--
+`playerNumber` should be a number
+
+```js
+assert(typeof playerNumber === 'number');
```
-
+The variable `player` should be a string
-## Challenge Seed
-
+```js
+assert(typeof player === 'string');
+```
-
+The value of `player` should be "Montana"
+
+```js
+assert(player === 'Montana');
+```
+
+You should use bracket notation to access `testObj`
+
+```js
+assert(/testObj\s*?\[.*?\]/.test(code));
+```
+
+You should not assign the value `Montana` to the variable `player` directly.
+
+```js
+assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi));
+```
+
+You should be using the variable `playerNumber` in your bracket notation
+
+```js
+assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code));
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+if(typeof player !== "undefined"){(function(v){return v;})(player);}
+```
+
+## --seed-contents--
```js
// Setup
@@ -83,23 +103,7 @@ var playerNumber; // Change this line
var player = testObj; // Change this line
```
-
-
-
-### After Test
-
-
-```js
-if(typeof player !== "undefined"){(function(v){return v;})(player);}
-```
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var testObj = {
@@ -110,5 +114,3 @@ var testObj = {
var playerNumber = 16;
var player = testObj[playerNumber];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md
index 7614aabd1d..18774ef640 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md
@@ -6,14 +6,19 @@ videoUrl: 'https://scrimba.com/c/cQe38UD'
forumTopicId: 301169
---
-## Description
-
+# --description--
+
You can add new properties to existing JavaScript objects the same way you would modify them.
-Here's how we would add a "bark" property to ourDog:
-ourDog.bark = "bow-wow";
+
+Here's how we would add a `"bark"` property to `ourDog`:
+
+`ourDog.bark = "bow-wow";`
+
or
-ourDog["bark"] = "bow-wow";
-Now when we evaluate ourDog.bark, we'll get his bark, "bow-wow".
+
+`ourDog["bark"] = "bow-wow";`
+
+Now when we evaluate `ourDog.bark`, we'll get his bark, "bow-wow".
Example:
@@ -28,31 +33,33 @@ var ourDog = {
ourDog.bark = "bow-wow";
```
-
+# --instructions--
-## Instructions
-
-Add a "bark" property to myDog and set it to a dog sound, such as "woof". You may use either dot or bracket notation.
-
+Add a `"bark"` property to `myDog` and set it to a dog sound, such as "woof". You may use either dot or bracket notation.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should add the property "bark" to myDog.
- testString: assert(myDog.bark !== undefined);
- - text: You should not add "bark" to the setup section.
- testString: assert(!/bark[^\n]:/.test(code));
+You should add the property `"bark"` to `myDog`.
+```js
+assert(myDog.bark !== undefined);
```
-
+You should not add `"bark"` to the setup section.
-## Challenge Seed
-
+```js
+assert(!/bark[^\n]:/.test(code));
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(z){return z;})(myDog);
+```
+
+## --seed-contents--
```js
// Setup
@@ -64,26 +71,9 @@ var myDog = {
};
// Only change code below this line
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myDog = {
@@ -94,5 +84,3 @@ var myDog = {
};
myDog.bark = "Woof Woof";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md
index adad0bd793..f455c491fa 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md
@@ -6,68 +6,54 @@ videoUrl: 'https://scrimba.com/c/cM2KBAG'
forumTopicId: 16650
---
-## Description
-
-Number is a data type in JavaScript which represents numeric data.
+# --description--
+
+`Number` is a data type in JavaScript which represents numeric data.
+
Now let's try to add two numbers using JavaScript.
-JavaScript uses the + symbol as an addition operator when placed between two numbers.
-Example:
+
+JavaScript uses the `+` symbol as an addition operator when placed between two numbers.
+
+**Example:**
```js
myVar = 5 + 10; // assigned 15
```
-
+# --instructions--
-## Instructions
-
-Change the 0 so that sum will equal 20.
-
+Change the `0` so that sum will equal `20`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: sum should equal 20.
- testString: assert(sum === 20);
- - text: You should use the + operator.
- testString: assert(/\+/.test(code));
-
-```
-
-
-
-## Challenge Seed
-
-
-
+`sum` should equal `20`.
```js
-var sum = 10 + 0;
-
+assert(sum === 20);
```
-
+You should use the `+` operator.
+```js
+assert(/\+/.test(code));
+```
-### After Test
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var sum = 10 + 0;
+```
+# --solutions--
```js
var sum = 10 + 10;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md
index 31da473db6..e291b3cecc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/c3JvVfg'
forumTopicId: 16653
---
-## Description
-
-In a switch statement you may not be able to specify all possible values as case statements. Instead, you can add the default statement which will be executed if no matching case statements are found. Think of it like the final else statement in an if/else chain.
-A default statement should be the last case.
+# --description--
+
+In a `switch` statement you may not be able to specify all possible values as `case` statements. Instead, you can add the `default` statement which will be executed if no matching `case` statements are found. Think of it like the final `else` statement in an `if/else` chain.
+
+A `default` statement should be the last case.
```js
switch (num) {
@@ -26,43 +27,67 @@ switch (num) {
}
```
-
+# --instructions--
-## Instructions
-
-Write a switch statement to set answer for the following conditions: "a" - "apple" "b" - "bird" "c" - "cat" default - "stuff"
-
+Write a switch statement to set `answer` for the following conditions:
+`"a"` - "apple"
+`"b"` - "bird"
+`"c"` - "cat"
+`default` - "stuff"
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: switchOfStuff("a") should have a value of "apple"
- testString: assert(switchOfStuff("a") === "apple");
- - text: switchOfStuff("b") should have a value of "bird"
- testString: assert(switchOfStuff("b") === "bird");
- - text: switchOfStuff("c") should have a value of "cat"
- testString: assert(switchOfStuff("c") === "cat");
- - text: switchOfStuff("d") should have a value of "stuff"
- testString: assert(switchOfStuff("d") === "stuff");
- - text: switchOfStuff(4) should have a value of "stuff"
- testString: assert(switchOfStuff(4) === "stuff");
- - text: You should not use any if or else statements
- testString: assert(!/else/g.test(code) || !/if/g.test(code));
- - text: You should use a default statement
- testString: assert(switchOfStuff("string-to-trigger-default-case") === "stuff");
- - text: You should have at least 3 break statements
- testString: assert(code.match(/break/g).length > 2);
+`switchOfStuff("a")` should have a value of "apple"
+```js
+assert(switchOfStuff('a') === 'apple');
```
-
+`switchOfStuff("b")` should have a value of "bird"
-## Challenge Seed
-
+```js
+assert(switchOfStuff('b') === 'bird');
+```
-
+`switchOfStuff("c")` should have a value of "cat"
+
+```js
+assert(switchOfStuff('c') === 'cat');
+```
+
+`switchOfStuff("d")` should have a value of "stuff"
+
+```js
+assert(switchOfStuff('d') === 'stuff');
+```
+
+`switchOfStuff(4)` should have a value of "stuff"
+
+```js
+assert(switchOfStuff(4) === 'stuff');
+```
+
+You should not use any `if` or `else` statements
+
+```js
+assert(!/else/g.test(code) || !/if/g.test(code));
+```
+
+You should use a `default` statement
+
+```js
+assert(switchOfStuff('string-to-trigger-default-case') === 'stuff');
+```
+
+You should have at least 3 `break` statements
+
+```js
+assert(code.match(/break/g).length > 2);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function switchOfStuff(val) {
@@ -76,18 +101,9 @@ function switchOfStuff(val) {
}
switchOfStuff(1);
-
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function switchOfStuff(val) {
@@ -109,5 +125,3 @@ function switchOfStuff(val) {
return answer;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md
index 15540d5134..688cea3244 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/cbQmZfa'
forumTopicId: 16656
---
-## Description
-
-Just as we can build a string over multiple lines out of string literals, we can also append variables to a string using the plus equals (+=) operator.
+# --description--
+
+Just as we can build a string over multiple lines out of string literals, we can also append variables to a string using the plus equals (`+=`) operator.
Example:
@@ -19,45 +19,27 @@ ourStr += anAdjective;
// ourStr is now "freeCodeCamp is awesome!"
```
-
+# --instructions--
-## Instructions
-
-Set someAdjective to a string of at least 3 characters and append it to myStr using the += operator.
-
+Set `someAdjective` to a string of at least 3 characters and append it to `myStr` using the `+=` operator.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: someAdjective should be set to a string at least 3 characters long.
- testString: assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2);
- - text: You should append someAdjective to myStr using the += operator.
- testString: assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0);
-
-```
-
-
-
-## Challenge Seed
-
-
-
+`someAdjective` should be set to a string at least 3 characters long.
```js
-// Change code below this line
-
-var someAdjective;
-var myStr = "Learning to code is ";
-
+assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2);
```
-
+You should append `someAdjective` to `myStr` using the `+=` operator.
+```js
+assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0);
+```
-### After Test
-
+# --seed--
+
+## --after-user-code--
```js
(function(){
@@ -76,18 +58,19 @@ var myStr = "Learning to code is ";
})();
```
-
+## --seed-contents--
-
+```js
+// Change code below this line
-## Solution
-
+var someAdjective;
+var myStr = "Learning to code is ";
+```
+# --solutions--
```js
var someAdjective = "neat";
var myStr = "Learning to code is ";
myStr += someAdjective;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md
index b688730ab6..b2d00d91a0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md
@@ -6,9 +6,8 @@ videoUrl: ''
forumTopicId: 418265
---
-## Description
+# --description--
-
After a value is assigned to a variable using the assignment operator, you can assign the value of that variable to another variable using the assignment operator.
```js
@@ -20,50 +19,33 @@ myNum = myVar;
The above declares a `myVar` variable with no value, then assigns it the value `5`. Next, a variable named `myNum` is declared with no value. Then, the contents of `myVar` (which is `5`) is assigned to the variable `myNum`. Now, `myNum` also has the value of `5`.
-
+# --instructions--
-## Instructions
+Assign the contents of `a` to variable `b`.
-
-Assign the contents of a to variable b.
-
+# --hints--
-## Tests
-
-
-
-```yml
-tests:
- - text: You should not change code above the specified comment.
- testString: assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code));
- - text: b should have a value of 7.
- testString: assert(typeof b === 'number' && b === 7);
- - text: a should be assigned to b with =.
- testString: assert(/b\s*=\s*a\s*/g.test(code));
-```
-
-
-
-## Challenge Seed
-
-
-
-
+You should not change code above the specified comment.
```js
-// Setup
-var a;
-a = 7;
-var b;
-
-// Only change code below this line
+assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code));
```
-
+`b` should have a value of 7.
-### Before Test
+```js
+assert(typeof b === 'number' && b === 7);
+```
-
+`a` should be assigned to `b` with `=`.
+
+```js
+assert(/b\s*=\s*a\s*/g.test(code));
+```
+
+# --seed--
+
+## --before-user-code--
```js
if (typeof a != 'undefined') {
@@ -74,11 +56,7 @@ if (typeof b != 'undefined') {
}
```
-
-
-### After Test
-
-
+## --after-user-code--
```js
(function(a, b) {
@@ -86,13 +64,18 @@ if (typeof b != 'undefined') {
})(a, b);
```
-
+## --seed-contents--
-
+```js
+// Setup
+var a;
+a = 7;
+var b;
-## Solution
+// Only change code below this line
+```
-
+# --solutions--
```js
var a;
@@ -100,5 +83,3 @@ a = 7;
var b;
b = a;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md
index dacc521208..1ff2a47a26 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md
@@ -6,37 +6,43 @@ videoUrl: 'https://scrimba.com/c/ce2pEtB'
forumTopicId: 16658
---
-## Description
-
-If you'll recall from our discussion of Storing Values with the Assignment Operator, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.
-Assume we have pre-defined a function sum which adds two numbers together, then:
-ourSum = sum(5, 12);
-will call sum function, which returns a value of 17 and assigns it to ourSum variable.
-
+# --description--
-## Instructions
-
-Call the processArg function with an argument of 7 and assign its return value to the variable processed.
-
+If you'll recall from our discussion of [Storing Values with the Assignment Operator](/learn/javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator), everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.
-## Tests
-
+Assume we have pre-defined a function `sum` which adds two numbers together, then:
-```yml
-tests:
- - text: processed should have a value of 2
- testString: assert(processed === 2);
- - text: You should assign processArg to processed
- testString: assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code));
+`ourSum = sum(5, 12);`
+will call `sum` function, which returns a value of `17` and assigns it to `ourSum` variable.
+
+# --instructions--
+
+Call the `processArg` function with an argument of `7` and assign its return value to the variable `processed`.
+
+# --hints--
+
+`processed` should have a value of `2`
+
+```js
+assert(processed === 2);
```
-
+You should assign `processArg` to `processed`
-## Challenge Seed
-
+```js
+assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code));
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(){return "processed = " + processed})();
+```
+
+## --seed-contents--
```js
// Setup
@@ -47,26 +53,9 @@ function processArg(num) {
}
// Only change code below this line
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var processed = 0;
@@ -77,5 +66,3 @@ function processArg(num) {
processed = processArg(7);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md
index 6d7f074ab9..9072cf7c35 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.md
@@ -6,11 +6,14 @@ videoUrl: 'https://scrimba.com/c/cWGkbtd'
forumTopicId: 16769
---
-## Description
-
-You may have heard the term object before.
-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.
+# --description--
+
+You may have heard the term `object` before.
+
+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`.
+
Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.
+
Here's a sample cat object:
```js
@@ -22,7 +25,7 @@ var cat = {
};
```
-In this example, all the properties are stored as strings, such as - "name", "legs", and "tails". However, you can also use numbers as properties. You can even omit the quotes for single-word string properties, as follows:
+In this example, all the properties are stored as strings, such as - `"name"`, `"legs"`, and `"tails"`. However, you can also use numbers as properties. You can even omit the quotes for single-word string properties, as follows:
```js
var anotherObject = {
@@ -33,38 +36,106 @@ var anotherObject = {
```
However, if your object has any non-string properties, JavaScript will automatically typecast them as strings.
-
-## Instructions
-
-Make an object that represents a dog called myDog which contains the properties "name" (a string), "legs", "tails" and "friends".
-You can set these object properties to whatever values you want, as long as "name" is a string, "legs" and "tails" are numbers, and "friends" is an array.
-
+# --instructions--
-## Tests
-
+Make an object that represents a dog called `myDog` which contains the properties `"name"` (a string), `"legs"`, `"tails"` and `"friends"`.
-```yml
-tests:
- - text: myDog should contain the property name and it should be a string.
- testString: assert((function(z){if(z.hasOwnProperty("name") && z.name !== undefined && typeof z.name === "string"){return true;}else{return false;}})(myDog));
- - text: myDog should contain the property legs and it should be a number.
- testString: assert((function(z){if(z.hasOwnProperty("legs") && z.legs !== undefined && typeof z.legs === "number"){return true;}else{return false;}})(myDog));
- - text: myDog should contain the property tails and it should be a number.
- testString: assert((function(z){if(z.hasOwnProperty("tails") && z.tails !== undefined && typeof z.tails === "number"){return true;}else{return false;}})(myDog));
- - text: myDog should contain the property friends and it should be an array.
- testString: assert((function(z){if(z.hasOwnProperty("friends") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog));
- - text: myDog should only contain all the given properties.
- testString: assert((function(z){return Object.keys(z).length === 4;})(myDog));
+You can set these object properties to whatever values you want, as long as `"name"` is a string, `"legs"` and `"tails"` are numbers, and `"friends"` is an array.
+# --hints--
+
+`myDog` should contain the property `name` and it should be a `string`.
+
+```js
+assert(
+ (function (z) {
+ if (
+ z.hasOwnProperty('name') &&
+ z.name !== undefined &&
+ typeof z.name === 'string'
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })(myDog)
+);
```
-
+`myDog` should contain the property `legs` and it should be a `number`.
-## Challenge Seed
-
+```js
+assert(
+ (function (z) {
+ if (
+ z.hasOwnProperty('legs') &&
+ z.legs !== undefined &&
+ typeof z.legs === 'number'
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })(myDog)
+);
+```
-
+`myDog` should contain the property `tails` and it should be a `number`.
+
+```js
+assert(
+ (function (z) {
+ if (
+ z.hasOwnProperty('tails') &&
+ z.tails !== undefined &&
+ typeof z.tails === 'number'
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })(myDog)
+);
+```
+
+`myDog` should contain the property `friends` and it should be an `array`.
+
+```js
+assert(
+ (function (z) {
+ if (
+ z.hasOwnProperty('friends') &&
+ z.friends !== undefined &&
+ Array.isArray(z.friends)
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })(myDog)
+);
+```
+
+`myDog` should only contain all the given properties.
+
+```js
+assert(
+ (function (z) {
+ return Object.keys(z).length === 4;
+ })(myDog)
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(z){return z;})(myDog);
+```
+
+## --seed-contents--
```js
var myDog = {
@@ -75,23 +146,7 @@ var myDog = {
};
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myDog = {
@@ -101,5 +156,3 @@ var myDog = {
"friends": ["everything!"]
};
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md
index 874eb2c99a..5eb021acfc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/caeJgsw'
forumTopicId: 16772
---
-## Description
-
-if/else statements can be chained together for complex logic. Here is pseudocode of multiple chained if / else if statements:
+# --description--
+
+`if/else` statements can be chained together for complex logic. Here is pseudocode of multiple chained `if` / `else if` statements:
```js
if (condition1) {
@@ -23,54 +23,99 @@ if (condition1) {
}
```
-
+# --instructions--
-## Instructions
-
-Write chained if/else if statements to fulfill the following conditions:
-num < 5 - return "Tiny" num < 10 - return "Small" num < 15 - return "Medium" num < 20 - return "Large" num >= 20 - return "Huge"
-
+Write chained `if`/`else if` statements to fulfill the following conditions:
-## Tests
-
+`num < 5` - return "Tiny"
+`num < 10` - return "Small"
+`num < 15` - return "Medium"
+`num < 20` - return "Large"
+`num >= 20` - return "Huge"
-```yml
-tests:
- - text: You should have at least four else statements
- testString: assert(code.match(/else/g).length > 3);
- - text: You should have at least four if statements
- testString: assert(code.match(/if/g).length > 3);
- - text: You should have at least one return statement
- testString: assert(code.match(/return/g).length >= 1);
- - text: testSize(0) should return "Tiny"
- testString: assert(testSize(0) === "Tiny");
- - text: testSize(4) should return "Tiny"
- testString: assert(testSize(4) === "Tiny");
- - text: testSize(5) should return "Small"
- testString: assert(testSize(5) === "Small");
- - text: testSize(8) should return "Small"
- testString: assert(testSize(8) === "Small");
- - text: testSize(10) should return "Medium"
- testString: assert(testSize(10) === "Medium");
- - text: testSize(14) should return "Medium"
- testString: assert(testSize(14) === "Medium");
- - text: testSize(15) should return "Large"
- testString: assert(testSize(15) === "Large");
- - text: testSize(17) should return "Large"
- testString: assert(testSize(17) === "Large");
- - text: testSize(20) should return "Huge"
- testString: assert(testSize(20) === "Huge");
- - text: testSize(25) should return "Huge"
- testString: assert(testSize(25) === "Huge");
+# --hints--
+You should have at least four `else` statements
+
+```js
+assert(code.match(/else/g).length > 3);
```
-
+You should have at least four `if` statements
-## Challenge Seed
-
+```js
+assert(code.match(/if/g).length > 3);
+```
-
+You should have at least one `return` statement
+
+```js
+assert(code.match(/return/g).length >= 1);
+```
+
+`testSize(0)` should return "Tiny"
+
+```js
+assert(testSize(0) === 'Tiny');
+```
+
+`testSize(4)` should return "Tiny"
+
+```js
+assert(testSize(4) === 'Tiny');
+```
+
+`testSize(5)` should return "Small"
+
+```js
+assert(testSize(5) === 'Small');
+```
+
+`testSize(8)` should return "Small"
+
+```js
+assert(testSize(8) === 'Small');
+```
+
+`testSize(10)` should return "Medium"
+
+```js
+assert(testSize(10) === 'Medium');
+```
+
+`testSize(14)` should return "Medium"
+
+```js
+assert(testSize(14) === 'Medium');
+```
+
+`testSize(15)` should return "Large"
+
+```js
+assert(testSize(15) === 'Large');
+```
+
+`testSize(17)` should return "Large"
+
+```js
+assert(testSize(17) === 'Large');
+```
+
+`testSize(20)` should return "Huge"
+
+```js
+assert(testSize(20) === 'Huge');
+```
+
+`testSize(25)` should return "Huge"
+
+```js
+assert(testSize(25) === 'Huge');
+```
+
+# --seed--
+
+## --seed-contents--
```js
function testSize(num) {
@@ -84,15 +129,7 @@ function testSize(num) {
testSize(7);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testSize(num) {
@@ -109,5 +146,3 @@ function testSize(num) {
}
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md
index 7bfbbaf5af..21e7f5d03d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md
@@ -6,67 +6,56 @@ videoUrl: 'https://scrimba.com/c/c7ynnTp'
forumTopicId: 16783
---
-## Description
-
+# --description--
+
Comments are lines of code that JavaScript will intentionally ignore. Comments are a great way to leave notes to yourself and to other people who will later need to figure out what that code does.
+
There are two ways to write comments in JavaScript:
-Using // will tell JavaScript to ignore the remainder of the text on the current line:
+
+Using `//` will tell JavaScript to ignore the remainder of the text on the current line:
```js
// This is an in-line comment.
```
-You can make a multi-line comment beginning with /\* and ending with \*/:
+You can make a multi-line comment beginning with `/*` and ending with `*/`:
```js
/* This is a
multi-line comment */
```
-Best Practice As you write code, you should regularly add comments to clarify the function of parts of your code. Good commenting can help communicate the intent of your code—both for others and for your future self.
-
+**Best Practice**
+As you write code, you should regularly add comments to clarify the function of parts of your code. Good commenting can help communicate the intent of your code—both for others *and* for your future self.
+
+# --instructions--
-## Instructions
-
Try creating one of each type of comment.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should create a // style comment that contains at least five letters.
- testString: assert(code.match(/(\/\/)...../g));
- - text: You should create a /* */ style comment that contains at least five letters.
- testString: assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm));
-
-```
-
-
-
-## Challenge Seed
-
-
-
+You should create a `//` style comment that contains at least five letters.
```js
-
+assert(code.match(/(\/\/)...../g));
```
-
+You should create a `/* */` style comment that contains at least five letters.
+```js
+assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm));
+```
+# --seed--
-
+## --seed-contents--
-## Solution
-
+```js
+```
+# --solutions--
```js
// Fake Comment
/* Another Comment */
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md
index 5913f97743..93e30d7176 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cKyVMAL'
forumTopicId: 16784
---
-## Description
-
-There are many comparison operators in JavaScript. All of these operators return a boolean true or false value.
-The most basic operator is the equality operator ==. The equality operator compares two values and returns true if they're equivalent or false if they are not. Note that equality is different from assignment (=), which assigns the value on the right of the operator to a variable on the left.
+# --description--
+
+There are many comparison operators in JavaScript. All of these operators return a boolean `true` or `false` value.
+
+The most basic operator is the equality operator `==`. The equality operator compares two values and returns `true` if they're equivalent or `false` if they are not. Note that equality is different from assignment (`=`), which assigns the value on the right of the operator to a variable on the left.
```js
function equalityTest(myVal) {
@@ -20,8 +21,7 @@ function equalityTest(myVal) {
}
```
-If myVal is equal to 10, the equality operator returns true, so the code in the curly braces will execute, and the function will return "Equal". Otherwise, the function will return "Not Equal".
-In order for JavaScript to compare two different data types (for example, numbers and strings), it must convert one type to another. This is known as "Type Coercion". Once it does, however, it can compare terms as follows:
+If `myVal` is equal to `10`, the equality operator returns `true`, so the code in the curly braces will execute, and the function will return `"Equal"`. Otherwise, the function will return `"Not Equal"`. In order for JavaScript to compare two different data types (for example, `numbers` and `strings`), it must convert one type to another. This is known as "Type Coercion". Once it does, however, it can compare terms as follows:
```js
1 == 1 // true
@@ -30,35 +30,39 @@ In order for JavaScript to compare two different data types (for exam
"3" == 3 // true
```
-
+# --instructions--
-## Instructions
-
-Add the equality operator to the indicated line so that the function will return "Equal" when val is equivalent to 12.
-
+Add the equality operator to the indicated line so that the function will return "Equal" when `val` is equivalent to `12`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: testEqual(10) should return "Not Equal"
- testString: assert(testEqual(10) === "Not Equal");
- - text: testEqual(12) should return "Equal"
- testString: assert(testEqual(12) === "Equal");
- - text: testEqual("12") should return "Equal"
- testString: assert(testEqual("12") === "Equal");
- - text: You should use the == operator
- testString: assert(code.match(/==/g) && !code.match(/===/g));
+`testEqual(10)` should return "Not Equal"
+```js
+assert(testEqual(10) === 'Not Equal');
```
-
+`testEqual(12)` should return "Equal"
-## Challenge Seed
-
+```js
+assert(testEqual(12) === 'Equal');
+```
-
+`testEqual("12")` should return "Equal"
+
+```js
+assert(testEqual('12') === 'Equal');
+```
+
+You should use the `==` operator
+
+```js
+assert(code.match(/==/g) && !code.match(/===/g));
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -72,15 +76,7 @@ function testEqual(val) {
testEqual(10);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testEqual(val) {
@@ -90,5 +86,3 @@ function testEqual(val) {
return "Not Equal";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md
index e7521b4c61..080f7cd804 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md
@@ -6,11 +6,13 @@ videoUrl: 'https://scrimba.com/c/cp6GbH4'
forumTopicId: 16786
---
-## Description
-
-The greater than operator (>) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns true. Otherwise, it returns false.
+# --description--
+
+The greater than operator (`>`) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns `true`. Otherwise, it returns `false`.
+
Like the equality operator, greater than operator will convert data types of values while comparing.
-Examples
+
+**Examples**
```js
5 > 3 // true
@@ -19,43 +21,63 @@ Like the equality operator, greater than operator will convert data types of val
'1' > 9 // false
```
-
+# --instructions--
-## Instructions
-
Add the greater than operator to the indicated lines so that the return statements make sense.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: testGreaterThan(0) should return "10 or Under"
- testString: assert(testGreaterThan(0) === "10 or Under");
- - text: testGreaterThan(10) should return "10 or Under"
- testString: assert(testGreaterThan(10) === "10 or Under");
- - text: testGreaterThan(11) should return "Over 10"
- testString: assert(testGreaterThan(11) === "Over 10");
- - text: testGreaterThan(99) should return "Over 10"
- testString: assert(testGreaterThan(99) === "Over 10");
- - text: testGreaterThan(100) should return "Over 10"
- testString: assert(testGreaterThan(100) === "Over 10");
- - text: testGreaterThan(101) should return "Over 100"
- testString: assert(testGreaterThan(101) === "Over 100");
- - text: testGreaterThan(150) should return "Over 100"
- testString: assert(testGreaterThan(150) === "Over 100");
- - text: You should use the > operator at least twice
- testString: assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1);
+`testGreaterThan(0)` should return "10 or Under"
+```js
+assert(testGreaterThan(0) === '10 or Under');
```
-
+`testGreaterThan(10)` should return "10 or Under"
-## Challenge Seed
-
+```js
+assert(testGreaterThan(10) === '10 or Under');
+```
-
+`testGreaterThan(11)` should return "Over 10"
+
+```js
+assert(testGreaterThan(11) === 'Over 10');
+```
+
+`testGreaterThan(99)` should return "Over 10"
+
+```js
+assert(testGreaterThan(99) === 'Over 10');
+```
+
+`testGreaterThan(100)` should return "Over 10"
+
+```js
+assert(testGreaterThan(100) === 'Over 10');
+```
+
+`testGreaterThan(101)` should return "Over 100"
+
+```js
+assert(testGreaterThan(101) === 'Over 100');
+```
+
+`testGreaterThan(150)` should return "Over 100"
+
+```js
+assert(testGreaterThan(150) === 'Over 100');
+```
+
+You should use the `>` operator at least twice
+
+```js
+assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function testGreaterThan(val) {
@@ -73,15 +95,7 @@ function testGreaterThan(val) {
testGreaterThan(10);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testGreaterThan(val) {
@@ -94,5 +108,3 @@ function testGreaterThan(val) {
return "10 or Under";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md
index 5bd9a5faa5..3b3e08be13 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md
@@ -6,11 +6,13 @@ videoUrl: 'https://scrimba.com/c/c6KBqtV'
forumTopicId: 16785
---
-## Description
-
-The greater than or equal to operator (>=) compares the values of two numbers. If the number to the left is greater than or equal to the number to the right, it returns true. Otherwise, it returns false.
-Like the equality operator, greater than or equal to operator will convert data types while comparing.
-Examples
+# --description--
+
+The greater than or equal to operator (`>=`) compares the values of two numbers. If the number to the left is greater than or equal to the number to the right, it returns `true`. Otherwise, it returns `false`.
+
+Like the equality operator, `greater than or equal to` operator will convert data types while comparing.
+
+**Examples**
```js
6 >= 6 // true
@@ -19,43 +21,63 @@ Like the equality operator, greater than or equal to operator will
'7' >= 9 // false
```
-
+# --instructions--
-## Instructions
-
Add the greater than or equal to operator to the indicated lines so that the return statements make sense.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: testGreaterOrEqual(0) should return "Less than 10"
- testString: assert(testGreaterOrEqual(0) === "Less than 10");
- - text: testGreaterOrEqual(9) should return "Less than 10"
- testString: assert(testGreaterOrEqual(9) === "Less than 10");
- - text: testGreaterOrEqual(10) should return "10 or Over"
- testString: assert(testGreaterOrEqual(10) === "10 or Over");
- - text: testGreaterOrEqual(11) should return "10 or Over"
- testString: assert(testGreaterOrEqual(11) === "10 or Over");
- - text: testGreaterOrEqual(19) should return "10 or Over"
- testString: assert(testGreaterOrEqual(19) === "10 or Over");
- - text: testGreaterOrEqual(100) should return "20 or Over"
- testString: assert(testGreaterOrEqual(100) === "20 or Over");
- - text: testGreaterOrEqual(21) should return "20 or Over"
- testString: assert(testGreaterOrEqual(21) === "20 or Over");
- - text: You should use the >= operator at least twice
- testString: assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1);
+`testGreaterOrEqual(0)` should return "Less than 10"
+```js
+assert(testGreaterOrEqual(0) === 'Less than 10');
```
-
+`testGreaterOrEqual(9)` should return "Less than 10"
-## Challenge Seed
-
+```js
+assert(testGreaterOrEqual(9) === 'Less than 10');
+```
-
+`testGreaterOrEqual(10)` should return "10 or Over"
+
+```js
+assert(testGreaterOrEqual(10) === '10 or Over');
+```
+
+`testGreaterOrEqual(11)` should return "10 or Over"
+
+```js
+assert(testGreaterOrEqual(11) === '10 or Over');
+```
+
+`testGreaterOrEqual(19)` should return "10 or Over"
+
+```js
+assert(testGreaterOrEqual(19) === '10 or Over');
+```
+
+`testGreaterOrEqual(100)` should return "20 or Over"
+
+```js
+assert(testGreaterOrEqual(100) === '20 or Over');
+```
+
+`testGreaterOrEqual(21)` should return "20 or Over"
+
+```js
+assert(testGreaterOrEqual(21) === '20 or Over');
+```
+
+You should use the `>=` operator at least twice
+
+```js
+assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function testGreaterOrEqual(val) {
@@ -73,15 +95,7 @@ function testGreaterOrEqual(val) {
testGreaterOrEqual(10);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testGreaterOrEqual(val) {
@@ -96,5 +110,3 @@ function testGreaterOrEqual(val) {
return "Less than 10";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md
index eb705e3915..4d7dd62d2a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cdBm9Sr'
forumTopicId: 16787
---
-## Description
-
-The inequality operator (!=) is the opposite of the equality operator. It means "Not Equal" and returns false where equality would return true and vice versa. Like the equality operator, the inequality operator will convert data types of values while comparing.
-Examples
+# --description--
+
+The inequality operator (`!=`) is the opposite of the equality operator. It means "Not Equal" and returns `false` where equality would return `true` and *vice versa*. Like the equality operator, the inequality operator will convert data types of values while comparing.
+
+**Examples**
```js
1 != 2 // true
@@ -19,39 +20,51 @@ The inequality operator (!=) is the opposite of the equality operat
0 != false // false
```
-
+# --instructions--
-## Instructions
-
-Add the inequality operator != in the if statement so that the function will return "Not Equal" when val is not equivalent to 99
-
+Add the inequality operator `!=` in the `if` statement so that the function will return "Not Equal" when `val` is not equivalent to `99`
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: testNotEqual(99) should return "Equal"
- testString: assert(testNotEqual(99) === "Equal");
- - text: testNotEqual("99") should return "Equal"
- testString: assert(testNotEqual("99") === "Equal");
- - text: testNotEqual(12) should return "Not Equal"
- testString: assert(testNotEqual(12) === "Not Equal");
- - text: testNotEqual("12") should return "Not Equal"
- testString: assert(testNotEqual("12") === "Not Equal");
- - text: testNotEqual("bob") should return "Not Equal"
- testString: assert(testNotEqual("bob") === "Not Equal");
- - text: You should use the != operator
- testString: assert(code.match(/(?!!==)!=/));
+`testNotEqual(99)` should return "Equal"
+```js
+assert(testNotEqual(99) === 'Equal');
```
-
+`testNotEqual("99")` should return "Equal"
-## Challenge Seed
-
+```js
+assert(testNotEqual('99') === 'Equal');
+```
-
+`testNotEqual(12)` should return "Not Equal"
+
+```js
+assert(testNotEqual(12) === 'Not Equal');
+```
+
+`testNotEqual("12")` should return "Not Equal"
+
+```js
+assert(testNotEqual('12') === 'Not Equal');
+```
+
+`testNotEqual("bob")` should return "Not Equal"
+
+```js
+assert(testNotEqual('bob') === 'Not Equal');
+```
+
+You should use the `!=` operator
+
+```js
+assert(code.match(/(?!!==)!=/));
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -65,15 +78,7 @@ function testNotEqual(val) {
testNotEqual(10);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testNotEqual(val) {
@@ -83,5 +88,3 @@ function testNotEqual(val) {
return "Equal";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md
index 51e528cc3f..19d3eb32e4 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cNVRWtB'
forumTopicId: 16789
---
-## Description
-
-The less than operator (<) compares the values of two numbers. If the number to the left is less than the number to the right, it returns true. Otherwise, it returns false. Like the equality operator, less than operator converts data types while comparing.
-Examples
+# --description--
+
+The less than operator (`<`) compares the values of two numbers. If the number to the left is less than the number to the right, it returns `true`. Otherwise, it returns `false`. Like the equality operator, less than operator converts data types while comparing.
+
+**Examples**
```js
2 < 5 // true
@@ -19,41 +20,57 @@ The less than operator (<) compares the values of two
'8' < 4 // false
```
-
+# --instructions--
-## Instructions
-
Add the less than operator to the indicated lines so that the return statements make sense.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: testLessThan(0) should return "Under 25"
- testString: assert(testLessThan(0) === "Under 25");
- - text: testLessThan(24) should return "Under 25"
- testString: assert(testLessThan(24) === "Under 25");
- - text: testLessThan(25) should return "Under 55"
- testString: assert(testLessThan(25) === "Under 55");
- - text: testLessThan(54) should return "Under 55"
- testString: assert(testLessThan(54) === "Under 55");
- - text: testLessThan(55) should return "55 or Over"
- testString: assert(testLessThan(55) === "55 or Over");
- - text: testLessThan(99) should return "55 or Over"
- testString: assert(testLessThan(99) === "55 or Over");
- - text: You should use the < operator at least twice
- testString: assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1);
+`testLessThan(0)` should return "Under 25"
+```js
+assert(testLessThan(0) === 'Under 25');
```
-
+`testLessThan(24)` should return "Under 25"
-## Challenge Seed
-
+```js
+assert(testLessThan(24) === 'Under 25');
+```
-
+`testLessThan(25)` should return "Under 55"
+
+```js
+assert(testLessThan(25) === 'Under 55');
+```
+
+`testLessThan(54)` should return "Under 55"
+
+```js
+assert(testLessThan(54) === 'Under 55');
+```
+
+`testLessThan(55)` should return "55 or Over"
+
+```js
+assert(testLessThan(55) === '55 or Over');
+```
+
+`testLessThan(99)` should return "55 or Over"
+
+```js
+assert(testLessThan(99) === '55 or Over');
+```
+
+You should use the `<` operator at least twice
+
+```js
+assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function testLessThan(val) {
@@ -71,15 +88,7 @@ function testLessThan(val) {
testLessThan(10);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testLessThan(val) {
@@ -94,5 +103,3 @@ function testLessThan(val) {
return "55 or Over";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md
index 1e16a4affa..fc15962101 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cNVR7Am'
forumTopicId: 16788
---
-## Description
-
-The less than or equal to operator (<=) compares the values of two numbers. If the number to the left is less than or equal to the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than or equal to converts data types.
-Examples
+# --description--
+
+The less than or equal to operator (`<=`) compares the values of two numbers. If the number to the left is less than or equal to the number to the right, it returns `true`. If the number on the left is greater than the number on the right, it returns `false`. Like the equality operator, `less than or equal to` converts data types.
+
+**Examples**
```js
4 <= 5 // true
@@ -19,43 +20,63 @@ The less than or equal to operator (<=) compares the values of t
'8' <= 4 // false
```
-
+# --instructions--
-## Instructions
-
Add the less than or equal to operator to the indicated lines so that the return statements make sense.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: testLessOrEqual(0) should return "Smaller Than or Equal to 12"
- testString: assert(testLessOrEqual(0) === "Smaller Than or Equal to 12");
- - text: testLessOrEqual(11) should return "Smaller Than or Equal to 12"
- testString: assert(testLessOrEqual(11) === "Smaller Than or Equal to 12");
- - text: testLessOrEqual(12) should return "Smaller Than or Equal to 12"
- testString: assert(testLessOrEqual(12) === "Smaller Than or Equal to 12");
- - text: testLessOrEqual(23) should return "Smaller Than or Equal to 24"
- testString: assert(testLessOrEqual(23) === "Smaller Than or Equal to 24");
- - text: testLessOrEqual(24) should return "Smaller Than or Equal to 24"
- testString: assert(testLessOrEqual(24) === "Smaller Than or Equal to 24");
- - text: testLessOrEqual(25) should return "More Than 24"
- testString: assert(testLessOrEqual(25) === "More Than 24");
- - text: testLessOrEqual(55) should return "More Than 24"
- testString: assert(testLessOrEqual(55) === "More Than 24");
- - text: You should use the <= operator at least twice
- testString: assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1);
+`testLessOrEqual(0)` should return "Smaller Than or Equal to 12"
+```js
+assert(testLessOrEqual(0) === 'Smaller Than or Equal to 12');
```
-
+`testLessOrEqual(11)` should return "Smaller Than or Equal to 12"
-## Challenge Seed
-
+```js
+assert(testLessOrEqual(11) === 'Smaller Than or Equal to 12');
+```
-
+`testLessOrEqual(12)` should return "Smaller Than or Equal to 12"
+
+```js
+assert(testLessOrEqual(12) === 'Smaller Than or Equal to 12');
+```
+
+`testLessOrEqual(23)` should return "Smaller Than or Equal to 24"
+
+```js
+assert(testLessOrEqual(23) === 'Smaller Than or Equal to 24');
+```
+
+`testLessOrEqual(24)` should return "Smaller Than or Equal to 24"
+
+```js
+assert(testLessOrEqual(24) === 'Smaller Than or Equal to 24');
+```
+
+`testLessOrEqual(25)` should return "More Than 24"
+
+```js
+assert(testLessOrEqual(25) === 'More Than 24');
+```
+
+`testLessOrEqual(55)` should return "More Than 24"
+
+```js
+assert(testLessOrEqual(55) === 'More Than 24');
+```
+
+You should use the `<=` operator at least twice
+
+```js
+assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function testLessOrEqual(val) {
@@ -71,18 +92,9 @@ function testLessOrEqual(val) {
}
testLessOrEqual(10);
-
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testLessOrEqual(val) {
@@ -97,5 +109,3 @@ function testLessOrEqual(val) {
return "More Than 24";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md
index ca784fd89b..6b9c6d38f2 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md
@@ -6,47 +6,54 @@ videoUrl: 'https://scrimba.com/c/cy87atr'
forumTopicId: 16790
---
-## Description
-
-Strict equality (===) is the counterpart to the equality operator (==). However, unlike the equality operator, which attempts to convert both values being compared to a common type, the strict equality operator does not perform a type conversion.
+# --description--
+
+Strict equality (`===`) is the counterpart to the equality operator (`==`). However, unlike the equality operator, which attempts to convert both values being compared to a common type, the strict equality operator does not perform a type conversion.
+
If the values being compared have different types, they are considered unequal, and the strict equality operator will return false.
-Examples
+
+**Examples**
```js
3 === 3 // true
3 === '3' // false
```
-In the second example, 3 is a Number type and '3' is a String type.
-
+In the second example, `3` is a `Number` type and `'3'` is a `String` type.
-## Instructions
-
-Use the strict equality operator in the if statement so the function will return "Equal" when val is strictly equal to 7
-
+# --instructions--
-## Tests
-
+Use the strict equality operator in the `if` statement so the function will return "Equal" when `val` is strictly equal to `7`
-```yml
-tests:
- - text: testStrict(10) should return "Not Equal"
- testString: assert(testStrict(10) === "Not Equal");
- - text: testStrict(7) should return "Equal"
- testString: assert(testStrict(7) === "Equal");
- - text: testStrict("7") should return "Not Equal"
- testString: assert(testStrict("7") === "Not Equal");
- - text: You should use the === operator
- testString: assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0);
+# --hints--
+`testStrict(10)` should return "Not Equal"
+
+```js
+assert(testStrict(10) === 'Not Equal');
```
-
+`testStrict(7)` should return "Equal"
-## Challenge Seed
-
+```js
+assert(testStrict(7) === 'Equal');
+```
-
+`testStrict("7")` should return "Not Equal"
+
+```js
+assert(testStrict('7') === 'Not Equal');
+```
+
+You should use the `===` operator
+
+```js
+assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -60,15 +67,7 @@ function testStrict(val) {
testStrict(10);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testStrict(val) {
@@ -78,5 +77,3 @@ function testStrict(val) {
return "Not Equal";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md
index ebdbd652c1..cf696056a7 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cKekkUy'
forumTopicId: 16791
---
-## Description
-
-The strict inequality operator (!==) is the logical opposite of the strict equality operator. It means "Strictly Not Equal" and returns false where strict equality would return true and vice versa. Strict inequality will not convert data types.
-Examples
+# --description--
+
+The strict inequality operator (`!==`) is the logical opposite of the strict equality operator. It means "Strictly Not Equal" and returns `false` where strict equality would return `true` and *vice versa*. Strict inequality will not convert data types.
+
+**Examples**
```js
3 !== 3 // false
@@ -17,37 +18,45 @@ The strict inequality operator (!==) is the logical opposite of the
4 !== 3 // true
```
-
+# --instructions--
-## Instructions
-
-Add the strict inequality operator to the if statement so the function will return "Not Equal" when val is not strictly equal to 17
-
+Add the strict inequality operator to the `if` statement so the function will return "Not Equal" when `val` is not strictly equal to `17`
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: testStrictNotEqual(17) should return "Equal"
- testString: assert(testStrictNotEqual(17) === "Equal");
- - text: testStrictNotEqual("17") should return "Not Equal"
- testString: assert(testStrictNotEqual("17") === "Not Equal");
- - text: testStrictNotEqual(12) should return "Not Equal"
- testString: assert(testStrictNotEqual(12) === "Not Equal");
- - text: testStrictNotEqual("bob") should return "Not Equal"
- testString: assert(testStrictNotEqual("bob") === "Not Equal");
- - text: You should use the !== operator
- testString: assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);
+`testStrictNotEqual(17)` should return "Equal"
+```js
+assert(testStrictNotEqual(17) === 'Equal');
```
-
+`testStrictNotEqual("17")` should return "Not Equal"
-## Challenge Seed
-
+```js
+assert(testStrictNotEqual('17') === 'Not Equal');
+```
-
+`testStrictNotEqual(12)` should return "Not Equal"
+
+```js
+assert(testStrictNotEqual(12) === 'Not Equal');
+```
+
+`testStrictNotEqual("bob")` should return "Not Equal"
+
+```js
+assert(testStrictNotEqual('bob') === 'Not Equal');
+```
+
+You should use the `!==` operator
+
+```js
+assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -61,15 +70,7 @@ function testStrictNotEqual(val) {
testStrictNotEqual(10);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testStrictNotEqual(val) {
@@ -79,5 +80,3 @@ function testStrictNotEqual(val) {
return "Equal";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md
index 7f460dd9b2..500d70378e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cvbRVtr'
forumTopicId: 16799
---
-## Description
-
-Sometimes you will need to test more than one thing at a time. The logical and operator (&&) returns true if and only if the operands to the left and right of it are true.
+# --description--
+
+Sometimes you will need to test more than one thing at a time. The logical and operator (`&&`) returns `true` if and only if the operands to the left and right of it are true.
+
The same effect could be achieved by nesting an if statement inside another if:
```js
@@ -20,7 +21,7 @@ if (num > 5) {
return "No";
```
-will only return "Yes" if num is greater than 5 and less than 10. The same logic can be written as:
+will only return "Yes" if `num` is greater than `5` and less than `10`. The same logic can be written as:
```js
if (num > 5 && num < 10) {
@@ -29,47 +30,75 @@ if (num > 5 && num < 10) {
return "No";
```
-
+# --instructions--
-## Instructions
-
-Replace the two if statements with one statement, using the && operator, which will return "Yes" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, will return "No".
-
+Replace the two if statements with one statement, using the && operator, which will return `"Yes"` if `val` is less than or equal to `50` and greater than or equal to `25`. Otherwise, will return `"No"`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should use the && operator once
- testString: assert(code.match(/&&/g).length === 1);
- - text: You should only have one if statement
- testString: assert(code.match(/if/g).length === 1);
- - text: testLogicalAnd(0) should return "No"
- testString: assert(testLogicalAnd(0) === "No");
- - text: testLogicalAnd(24) should return "No"
- testString: assert(testLogicalAnd(24) === "No");
- - text: testLogicalAnd(25) should return "Yes"
- testString: assert(testLogicalAnd(25) === "Yes");
- - text: testLogicalAnd(30) should return "Yes"
- testString: assert(testLogicalAnd(30) === "Yes");
- - text: testLogicalAnd(50) should return "Yes"
- testString: assert(testLogicalAnd(50) === "Yes");
- - text: testLogicalAnd(51) should return "No"
- testString: assert(testLogicalAnd(51) === "No");
- - text: testLogicalAnd(75) should return "No"
- testString: assert(testLogicalAnd(75) === "No");
- - text: testLogicalAnd(80) should return "No"
- testString: assert(testLogicalAnd(80) === "No");
+You should use the `&&` operator once
+```js
+assert(code.match(/&&/g).length === 1);
```
-
+You should only have one `if` statement
-## Challenge Seed
-
+```js
+assert(code.match(/if/g).length === 1);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testLogicalAnd(val) {
@@ -106,5 +127,3 @@ function testLogicalAnd(val) {
return "No";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md
index fcfab94917..85df0914d7 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/c/cEPrGTN'
forumTopicId: 16800
---
-## Description
-
-The logical or operator (||) returns true if either of the operands is true. Otherwise, it returns false.
-The logical or operator is composed of two pipe symbols: (||). This can typically be found between your Backspace and Enter keys.
+# --description--
+
+The logical or operator (`||`) returns `true` if either of the operands is `true`. Otherwise, it returns `false`.
+
+The logical or operator is composed of two pipe symbols: (`||`). This can typically be found between your Backspace and Enter keys.
+
The pattern below should look familiar from prior waypoints:
```js
@@ -22,7 +24,7 @@ if (num < 5) {
return "Yes";
```
-will return "Yes" only if num is between 5 and 10 (5 and 10 included). The same logic can be written as:
+will return "Yes" only if `num` is between `5` and `10` (5 and 10 included). The same logic can be written as:
```js
if (num > 10 || num < 5) {
@@ -31,47 +33,75 @@ if (num > 10 || num < 5) {
return "Yes";
```
-
+# --instructions--
-## Instructions
-
-Combine the two if statements into one statement which returns "Outside" if val is not between 10 and 20, inclusive. Otherwise, return "Inside".
-
+Combine the two `if` statements into one statement which returns `"Outside"` if `val` is not between `10` and `20`, inclusive. Otherwise, return `"Inside"`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should use the || operator once
- testString: assert(code.match(/\|\|/g).length === 1);
- - text: You should only have one if statement
- testString: assert(code.match(/if/g).length === 1);
- - text: testLogicalOr(0) should return "Outside"
- testString: assert(testLogicalOr(0) === "Outside");
- - text: testLogicalOr(9) should return "Outside"
- testString: assert(testLogicalOr(9) === "Outside");
- - text: testLogicalOr(10) should return "Inside"
- testString: assert(testLogicalOr(10) === "Inside");
- - text: testLogicalOr(15) should return "Inside"
- testString: assert(testLogicalOr(15) === "Inside");
- - text: testLogicalOr(19) should return "Inside"
- testString: assert(testLogicalOr(19) === "Inside");
- - text: testLogicalOr(20) should return "Inside"
- testString: assert(testLogicalOr(20) === "Inside");
- - text: testLogicalOr(21) should return "Outside"
- testString: assert(testLogicalOr(21) === "Outside");
- - text: testLogicalOr(25) should return "Outside"
- testString: assert(testLogicalOr(25) === "Outside");
+You should use the `||` operator once
+```js
+assert(code.match(/\|\|/g).length === 1);
```
-
+You should only have one `if` statement
-## Challenge Seed
-
+```js
+assert(code.match(/if/g).length === 1);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testLogicalOr(val) {
@@ -110,5 +132,3 @@ function testLogicalOr(val) {
return "Inside";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
index 0172f8cfc4..28e6fffd08 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
@@ -6,12 +6,15 @@ videoUrl: 'https://scrimba.com/c/cDR6LCb'
forumTopicId: 16661
---
-## Description
-
+# --description--
+
In programming, it is common to use assignments to modify the contents of a variable. Remember that everything to the right of the equals sign is evaluated first, so we can say:
-myVar = myVar + 5;
-to add 5 to myVar. Since this is such a common pattern, there are operators which do both a mathematical operation and assignment in one step.
-One such operator is the += operator.
+
+`myVar = myVar + 5;`
+
+to add `5` to `myVar`. Since this is such a common pattern, there are operators which do both a mathematical operation and assignment in one step.
+
+One such operator is the `+=` operator.
```js
var myVar = 1;
@@ -19,37 +22,55 @@ myVar += 5;
console.log(myVar); // Returns 6
```
-
+# --instructions--
-## Instructions
-
-Convert the assignments for a, b, and c to use the += operator.
-
+Convert the assignments for `a`, `b`, and `c` to use the `+=` operator.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: a should equal 15.
- testString: assert(a === 15);
- - text: b should equal 26.
- testString: assert(b === 26);
- - text: c should equal 19.
- testString: assert(c === 19);
- - text: You should use the += operator for each variable.
- testString: assert(code.match(/\+=/g).length === 3);
- - text: You should not modify the code above the specified comment.
- testString: assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code));
+`a` should equal `15`.
+```js
+assert(a === 15);
```
-
+`b` should equal `26`.
-## Challenge Seed
-
+```js
+assert(b === 26);
+```
-
+`c` should equal `19`.
+
+```js
+assert(c === 19);
+```
+
+You should use the `+=` operator for each variable.
+
+```js
+assert(code.match(/\+=/g).length === 3);
+```
+
+You should not modify the code above the specified comment.
+
+```js
+assert(
+ /var a = 3;/.test(code) &&
+ /var b = 17;/.test(code) &&
+ /var c = 12;/.test(code)
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
+```
+
+## --seed-contents--
```js
var a = 3;
@@ -62,23 +83,7 @@ b = 9 + b;
c = c + 7;
```
-
-
-
-### After Test
-
-
-```js
-(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
-```
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var a = 3;
@@ -89,5 +94,3 @@ a += 12;
b += 9;
c += 7;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md
index ac399d5b9e..eb9db30bd0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md
@@ -6,43 +6,65 @@ videoUrl: 'https://scrimba.com/c/c2QvKT2'
forumTopicId: 16659
---
-## Description
-
-The /= operator divides a variable by another number.
-myVar = myVar / 5;
-Will divide myVar by 5. This can be rewritten as:
-myVar /= 5;
-
+# --description--
-## Instructions
-
-Convert the assignments for a, b, and c to use the /= operator.
-
+The `/=` operator divides a variable by another number.
-## Tests
-
+`myVar = myVar / 5;`
-```yml
-tests:
- - text: a should equal 4.
- testString: assert(a === 4);
- - text: b should equal 27.
- testString: assert(b === 27);
- - text: c should equal 3.
- testString: assert(c === 3);
- - text: You should use the /= operator for each variable.
- testString: assert(code.match(/\/=/g).length === 3);
- - text: You should not modify the code above the specified comment.
- testString: assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code));
+Will divide `myVar` by `5`. This can be rewritten as:
+`myVar /= 5;`
+
+# --instructions--
+
+Convert the assignments for `a`, `b`, and `c` to use the `/=` operator.
+
+# --hints--
+
+`a` should equal `4`.
+
+```js
+assert(a === 4);
```
-
+`b` should equal `27`.
-## Challenge Seed
-
+```js
+assert(b === 27);
+```
-
+`c` should equal `3`.
+
+```js
+assert(c === 3);
+```
+
+You should use the `/=` operator for each variable.
+
+```js
+assert(code.match(/\/=/g).length === 3);
+```
+
+You should not modify the code above the specified comment.
+
+```js
+assert(
+ /var a = 48;/.test(code) &&
+ /var b = 108;/.test(code) &&
+ /var c = 33;/.test(code)
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
+```
+
+## --seed-contents--
```js
var a = 48;
@@ -55,23 +77,7 @@ b = b / 4;
c = c / 11;
```
-
-
-
-### After Test
-
-
-```js
-(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
-```
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var a = 48;
@@ -82,5 +88,3 @@ a /= 12;
b /= 4;
c /= 11;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
index 7bb4bcdd2c..5f1d4bbeeb 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
@@ -6,43 +6,65 @@ videoUrl: 'https://scrimba.com/c/c83vrfa'
forumTopicId: 16662
---
-## Description
-
-The *= operator multiplies a variable by a number.
-myVar = myVar * 5;
-will multiply myVar by 5. This can be rewritten as:
-myVar *= 5;
-
+# --description--
-## Instructions
-
-Convert the assignments for a, b, and c to use the *= operator.
-
+The `*=` operator multiplies a variable by a number.
-## Tests
-
+`myVar = myVar * 5;`
-```yml
-tests:
- - text: a should equal 25.
- testString: assert(a === 25);
- - text: b should equal 36.
- testString: assert(b === 36);
- - text: c should equal 46.
- testString: assert(c === 46);
- - text: You should use the *= operator for each variable.
- testString: assert(code.match(/\*=/g).length === 3);
- - text: You should not modify the code above the specified comment.
- testString: assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\.6;/.test(code));
+will multiply `myVar` by `5`. This can be rewritten as:
+`myVar *= 5;`
+
+# --instructions--
+
+Convert the assignments for `a`, `b`, and `c` to use the `*=` operator.
+
+# --hints--
+
+`a` should equal `25`.
+
+```js
+assert(a === 25);
```
-
+`b` should equal `36`.
-## Challenge Seed
-
+```js
+assert(b === 36);
+```
-
+`c` should equal `46`.
+
+```js
+assert(c === 46);
+```
+
+You should use the `*=` operator for each variable.
+
+```js
+assert(code.match(/\*=/g).length === 3);
+```
+
+You should not modify the code above the specified comment.
+
+```js
+assert(
+ /var a = 5;/.test(code) &&
+ /var b = 12;/.test(code) &&
+ /var c = 4\.6;/.test(code)
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
+```
+
+## --seed-contents--
```js
var a = 5;
@@ -55,23 +77,7 @@ b = 3 * b;
c = c * 10;
```
-
-
-
-### After Test
-
-
-```js
-(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
-```
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var a = 5;
@@ -82,5 +88,3 @@ a *= 5;
b *= 3;
c *= 10;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md
index 823a0d3faa..71d543bd5f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md
@@ -6,43 +6,63 @@ videoUrl: 'https://scrimba.com/c/c2Qv7AV'
forumTopicId: 16660
---
-## Description
-
-Like the += operator, -= subtracts a number from a variable.
-myVar = myVar - 5;
-will subtract 5 from myVar. This can be rewritten as:
-myVar -= 5;
-
+# --description--
-## Instructions
-
-Convert the assignments for a, b, and c to use the -= operator.
-
+Like the `+=` operator, `-=` subtracts a number from a variable.
-## Tests
-
+`myVar = myVar - 5;`
-```yml
-tests:
- - text: a should equal 5.
- testString: assert(a === 5);
- - text: b should equal -6.
- testString: assert(b === -6);
- - text: c should equal 2.
- testString: assert(c === 2);
- - text: You should use the -= operator for each variable.
- testString: assert(code.match(/-=/g).length === 3);
- - text: You should not modify the code above the specified comment.
- testString: assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code));
+will subtract `5` from `myVar`. This can be rewritten as:
+`myVar -= 5;`
+
+# --instructions--
+
+Convert the assignments for `a`, `b`, and `c` to use the `-=` operator.
+
+# --hints--
+
+`a` should equal `5`.
+
+```js
+assert(a === 5);
```
-
+`b` should equal `-6`.
-## Challenge Seed
-
+```js
+assert(b === -6);
+```
-
+`c` should equal `2`.
+
+```js
+assert(c === 2);
+```
+
+You should use the `-=` operator for each variable.
+
+```js
+assert(code.match(/-=/g).length === 3);
+```
+
+You should not modify the code above the specified comment.
+
+```js
+assert(
+ /var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code)
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
+```
+
+## --seed-contents--
```js
var a = 11;
@@ -55,23 +75,7 @@ b = b - 15;
c = c - 1;
```
-
-
-
-### After Test
-
-
-```js
-(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
-```
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var a = 11;
@@ -81,8 +85,4 @@ var c = 3;
a -= 6;
b -= 15;
c -= 1;
-
-
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md
index c7062aa3a2..0385048c93 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md
@@ -6,16 +6,18 @@ videoUrl: 'https://scrimba.com/c/cNpM8AN'
forumTopicId: 16802
---
-## Description
-
-In JavaScript, when the + operator is used with a String value, it is called the concatenation operator. You can build a new string out of other strings by concatenating them together.
-Example
+# --description--
+
+In JavaScript, when the `+` operator is used with a `String` value, it is called the concatenation operator. You can build a new string out of other strings by concatenating them together.
+
+**Example**
```js
'My name is Alan,' + ' I concatenate.'
```
-Note Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.
+**Note**
+Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.
Example:
@@ -24,46 +26,39 @@ var ourStr = "I come first. " + "I come second.";
// ourStr is "I come first. I come second."
```
-
+# --instructions--
-## Instructions
-
-Build myStr from the strings "This is the start. " and "This is the end." using the + operator.
-
+Build `myStr` from the strings `"This is the start. "` and `"This is the end."` using the `+` operator.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: myStr should have a value of This is the start. This is the end.
- testString: assert(myStr === "This is the start. This is the end.");
- - text: You should use the + operator to build myStr.
- testString: assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g));
- - text: myStr should be created using the var keyword.
- testString: assert(/var\s+myStr/.test(code));
- - text: You should assign the result to the myStr variable.
- testString: assert(/myStr\s*=/.test(code));
-
-```
-
-
-
-## Challenge Seed
-
-
-
+`myStr` should have a value of `This is the start. This is the end.`
```js
-var myStr; // Change this line
-
+assert(myStr === 'This is the start. This is the end.');
```
-
+You should use the `+` operator to build `myStr`.
+```js
+assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g));
+```
-### After Test
-
+`myStr` should be created using the `var` keyword.
+
+```js
+assert(/var\s+myStr/.test(code));
+```
+
+You should assign the result to the `myStr` variable.
+
+```js
+assert(/myStr\s*=/.test(code));
+```
+
+# --seed--
+
+## --after-user-code--
```js
(function(){
@@ -75,16 +70,14 @@ var myStr; // Change this line
})();
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var myStr; // Change this line
+```
+# --solutions--
```js
var myStr = "This is the start. " + "This is the end.";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md
index 0f60f61917..8b03c4c341 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/c/cbQmmC4'
forumTopicId: 16803
---
-## Description
-
-We can also use the += operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines.
-Note Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.
+# --description--
+
+We can also use the `+=` operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines.
+
+**Note**
+Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.
Example:
@@ -19,46 +21,27 @@ ourStr += "I come second.";
// ourStr is now "I come first. I come second."
```
-
+# --instructions--
-## Instructions
-
-Build myStr over several lines by concatenating these two strings: "This is the first sentence. " and "This is the second sentence." using the += operator. Use the += operator similar to how it is shown in the editor. Start by assigning the first string to myStr, then add on the second string.
-
+Build `myStr` over several lines by concatenating these two strings: `"This is the first sentence. "` and `"This is the second sentence."` using the `+=` operator. Use the `+=` operator similar to how it is shown in the editor. Start by assigning the first string to `myStr`, then add on the second string.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: myStr should have a value of This is the first sentence. This is the second sentence.
- testString: assert(myStr === "This is the first sentence. This is the second sentence.");
- - text: You should use the += operator to build myStr.
- testString: assert(code.match(/myStr\s*\+=\s*(["']).*\1/g));
-
-```
-
-
-
-## Challenge Seed
-
-
-
+`myStr` should have a value of `This is the first sentence. This is the second sentence.`
```js
-
-// Only change code below this line
-
-var myStr;
-
-
+assert(myStr === 'This is the first sentence. This is the second sentence.');
```
-
+You should use the `+=` operator to build `myStr`.
+```js
+assert(code.match(/myStr\s*\+=\s*(["']).*\1/g));
+```
-### After Test
-
+## --seed-contents--
-
+```js
+// Only change code below this line
-## Solution
-
+var myStr;
+```
+# --solutions--
```js
var myStr = "This is the first sentence. ";
myStr += "This is the second sentence.";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md
index 01c2083fb8..2b319f852e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/cqk8rf4'
forumTopicId: 16805
---
-## Description
-
-Sometimes you will need to build a string, Mad Libs style. By using the concatenation operator (+), you can insert one or more variables into a string you're building.
+# --description--
+
+Sometimes you will need to build a string, [Mad Libs](https://en.wikipedia.org/wiki/Mad_Libs) style. By using the concatenation operator (`+`), you can insert one or more variables into a string you're building.
Example:
@@ -18,45 +18,27 @@ var ourStr = "Hello, our name is " + ourName + ", how are you?";
// ourStr is now "Hello, our name is freeCodeCamp, how are you?"
```
-
+# --instructions--
-## Instructions
-
-Set myName to a string equal to your name and build myStr with myName between the strings "My name is " and " and I am well!"
-
+Set `myName` to a string equal to your name and build `myStr` with `myName` between the strings `"My name is "` and `" and I am well!"`
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: myName should be set to a string at least 3 characters long.
- testString: assert(typeof myName !== 'undefined' && myName.length > 2);
- - text: You should use two + operators to build myStr with myName inside it.
- testString: assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0);
-
-```
-
-
-
-## Challenge Seed
-
-
-
+`myName` should be set to a string at least 3 characters long.
```js
-// Only change code below this line
-var myName;
-var myStr;
-
-
+assert(typeof myName !== 'undefined' && myName.length > 2);
```
-
+You should use two `+` operators to build `myStr` with `myName` inside it.
+```js
+assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0);
+```
-### After Test
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+// Only change code below this line
+var myName;
+var myStr;
+```
+# --solutions--
```js
var myName = "Bob";
var myStr = "My name is " + myName + " and I am well!";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md
index 59c860aa5a..c096e76635 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md
@@ -6,11 +6,13 @@ videoUrl: 'https://scrimba.com/c/c2R6BHa'
forumTopicId: 16808
---
-## Description
-
+# --description--
+
A for loop can also count backwards, so long as we can define the right conditions.
-In order to count backwards by twos, we'll need to change our initialization, condition, and final-expression.
-We'll start at i = 10 and loop while i > 0. We'll decrement i by 2 each loop with i -= 2.
+
+In order to count backwards by twos, we'll need to change our `initialization`, `condition`, and `final-expression`.
+
+We'll start at `i = 10` and loop while `i > 0`. We'll decrement `i` by 2 each loop with `i -= 2`.
```js
var ourArray = [];
@@ -19,62 +21,50 @@ for (var i = 10; i > 0; i -= 2) {
}
```
-ourArray will now contain [10,8,6,4,2].
-Let's change our initialization and final-expression so we can count backward by twos by odd numbers.
-
+`ourArray` will now contain `[10,8,6,4,2]`. Let's change our `initialization` and `final-expression` so we can count backward by twos by odd numbers.
-## Instructions
-
-Push the odd numbers from 9 through 1 to myArray using a for loop.
-
+# --instructions--
-## Tests
-
+Push the odd numbers from 9 through 1 to `myArray` using a `for` loop.
-```yml
-tests:
- - text: You should be using a for loop for this.
- testString: assert(/for\s*\([^)]+?\)/.test(code));
- - text: You should be using the array method push.
- testString: assert(code.match(/myArray.push/));
- - text: myArray should equal [9,7,5,3,1].
- testString: assert.deepEqual(myArray, [9,7,5,3,1]);
+# --hints--
+You should be using a `for` loop for this.
+
+```js
+assert(/for\s*\([^)]+?\)/.test(code));
```
-
+You should be using the array method `push`.
-## Challenge Seed
-
+```js
+assert(code.match(/myArray.push/));
+```
-
+`myArray` should equal `[9,7,5,3,1]`.
+
+```js
+assert.deepEqual(myArray, [9, 7, 5, 3, 1]);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+if(typeof myArray !== "undefined"){(function(){return myArray;})();}
+```
+
+## --seed-contents--
```js
// Setup
var myArray = [];
// Only change code below this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [];
@@ -82,5 +72,3 @@ for (var i = 9; i > 0; i -= 2) {
myArray.push(i);
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md
index 1211816ed3..498327bc2a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md
@@ -6,49 +6,159 @@ videoUrl: 'https://scrimba.com/c/c6KE7ty'
forumTopicId: 16809
---
-## Description
-
-In the casino game Blackjack, a player can gain an advantage over the house by keeping track of the relative number of high and low cards remaining in the deck. This is called Card Counting.
+# --description--
+
+In the casino game Blackjack, a player can gain an advantage over the house by keeping track of the relative number of high and low cards remaining in the deck. This is called [Card Counting](https://en.wikipedia.org/wiki/Card_counting).
+
Having more high cards remaining in the deck favors the player. Each card is assigned a value according to the table below. When the count is positive, the player should bet high. When the count is zero or negative, the player should bet low.
-
Count Change
Cards
+1
2, 3, 4, 5, 6
0
7, 8, 9
-1
10, 'J', 'Q', 'K', 'A'
-You will write a card counting function. It will receive a card parameter, which can be a number or a string, and increment or decrement the global count variable according to the card's value (see table). The function will then return a string with the current count and the string Bet if the count is positive, or Hold if the count is zero or negative. The current count and the player's decision (Bet or Hold) should be separated by a single space.
-Example Output -3 Hold 5 Bet
-Hint Do NOT reset count to 0 when value is 7, 8, or 9. Do NOT return an array. Do NOT include quotes (single or double) in the output.
-
-## Instructions
-
+
Count Change
Cards
+1
2, 3, 4, 5, 6
0
7, 8, 9
-1
10, 'J', 'Q', 'K', 'A'
-
+You will write a card counting function. It will receive a `card` parameter, which can be a number or a string, and increment or decrement the global `count` variable according to the card's value (see table). The function will then return a string with the current count and the string `Bet` if the count is positive, or `Hold` if the count is zero or negative. The current count and the player's decision (`Bet` or `Hold`) should be separated by a single space.
-## Tests
-
+**Example Output**
+`-3 Hold`
+`5 Bet`
-```yml
-tests:
- - text: Cards Sequence 2, 3, 4, 5, 6 should return 5 Bet
- testString: assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === "5 Bet") {return true;} return false; })());
- - text: Cards Sequence 7, 8, 9 should return 0 Hold
- testString: assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === "0 Hold") {return true;} return false; })());
- - text: Cards Sequence 10, J, Q, K, A should return -5 Hold
- testString: assert((function(){ count = 0; cc(10);cc('J');cc('Q');cc('K');var out = cc('A'); if(out === "-5 Hold") {return true;} return false; })());
- - text: Cards Sequence 3, 7, Q, 8, A should return -1 Hold
- testString: assert((function(){ count = 0; cc(3);cc(7);cc('Q');cc(8);var out = cc('A'); if(out === "-1 Hold") {return true;} return false; })());
- - text: Cards Sequence 2, J, 9, 2, 7 should return 1 Bet
- testString: assert((function(){ count = 0; cc(2);cc('J');cc(9);cc(2);var out = cc(7); if(out === "1 Bet") {return true;} return false; })());
- - text: Cards Sequence 2, 2, 10 should return 1 Bet
- testString: assert((function(){ count = 0; cc(2);cc(2);var out = cc(10); if(out === "1 Bet") {return true;} return false; })());
- - text: Cards Sequence 3, 2, A, 10, K should return -1 Hold
- testString: assert((function(){ count = 0; cc(3);cc(2);cc('A');cc(10);var out = cc('K'); if(out === "-1 Hold") {return true;} return false; })());
+**Hint**
+Do NOT reset `count` to 0 when value is 7, 8, or 9.
+Do NOT return an array.
+Do NOT include quotes (single or double) in the output.
+# --hints--
+
+Cards Sequence 2, 3, 4, 5, 6 should return `5 Bet`
+
+```js
+assert(
+ (function () {
+ count = 0;
+ cc(2);
+ cc(3);
+ cc(4);
+ cc(5);
+ var out = cc(6);
+ if (out === '5 Bet') {
+ return true;
+ }
+ return false;
+ })()
+);
```
-
+Cards Sequence 7, 8, 9 should return `0 Hold`
-## Challenge Seed
-
+```js
+assert(
+ (function () {
+ count = 0;
+ cc(7);
+ cc(8);
+ var out = cc(9);
+ if (out === '0 Hold') {
+ return true;
+ }
+ return false;
+ })()
+);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var count = 0;
@@ -99,5 +201,3 @@ function cc(card) {
}
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
index e6f6b8da34..ce5913ea6c 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
@@ -6,64 +6,49 @@ videoUrl: 'https://scrimba.com/c/ca8GEuW'
forumTopicId: 16826
---
-## Description
-
+# --description--
+
We can store decimal numbers in variables too. Decimal numbers are sometimes referred to as floating point numbers or floats.
-Note Not all real numbers can accurately be represented in floating point. This can lead to rounding errors. Details Here.
-
-## Instructions
-
-Create a variable myDecimal and give it a decimal value with a fractional part (e.g. 5.7).
-
+**Note**
+Not all real numbers can accurately be represented in floating point. This can lead to rounding errors. [Details Here](https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems).
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: myDecimal should be a number.
- testString: assert(typeof myDecimal === "number");
- - text: myDecimal should have a decimal point
- testString: assert(myDecimal % 1 != 0);
+Create a variable `myDecimal` and give it a decimal value with a fractional part (e.g. `5.7`).
-```
+# --hints--
-
-
-## Challenge Seed
-
-
-
+`myDecimal` should be a number.
```js
-var ourDecimal = 5.7;
-
-// Only change code below this line
-
-
+assert(typeof myDecimal === 'number');
```
-
+`myDecimal` should have a decimal point
+```js
+assert(myDecimal % 1 != 0);
+```
-### After Test
-
+## --seed-contents--
-
+```js
+var ourDecimal = 5.7;
-## Solution
-
+// Only change code below this line
+```
+# --solutions--
```js
var myDecimal = 9.9;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md
index b6e1252a63..bff9158d38 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md
@@ -6,70 +6,54 @@ videoUrl: 'https://scrimba.com/c/cNanrHq'
forumTopicId: 17556
---
-## Description
-
-In computer science, data is anything that is meaningful to the computer. JavaScript provides eight different data types which are undefined, null, boolean, string, symbol, bigint, number, and object.
-For example, computers distinguish between numbers, such as the number 12, and strings, such as "12", "dog", or "123 cats", which are collections of characters. Computers can perform mathematical operations on a number, but not on a string.
+# --description--
+
+In computer science, data is anything that is meaningful to the computer. JavaScript provides eight different data types which are `undefined`, `null`, `boolean`, `string`, `symbol`, `bigint`, `number`, and `object`.
+
+For example, computers distinguish between numbers, such as the number `12`, and `strings`, such as `"12"`, `"dog"`, or `"123 cats"`, which are collections of characters. Computers can perform mathematical operations on a number, but not on a string.
+
Variables allow computers to store and manipulate data in a dynamic fashion. They do this by using a "label" to point to the data rather than using the data itself. Any of the eight data types may be stored in a variable.
-Variables are similar to the x and y variables you use in mathematics, which means they're a simple name to represent the data we want to refer to. Computer variables differ from mathematical variables in that they can store different values at different times.
-We tell JavaScript to create or declare a variable by putting the keyword var in front of it, like so:
+
+`Variables` are similar to the x and y variables you use in mathematics, which means they're a simple name to represent the data we want to refer to. Computer `variables` differ from mathematical variables in that they can store different values at different times.
+
+We tell JavaScript to create or declare a variable by putting the keyword `var` in front of it, like so:
```js
var ourName;
```
-creates a variable called ourName. In JavaScript we end statements with semicolons.
-Variable names can be made up of numbers, letters, and $ or _, but may not contain spaces or start with a number.
-
+creates a `variable` called `ourName`. In JavaScript we end statements with semicolons. `Variable` names can be made up of numbers, letters, and `$` or `_`, but may not contain spaces or start with a number.
-## Instructions
-
-Use the var keyword to create a variable called myName.
-Hint Look at the ourName example above if you get stuck.
-
+# --instructions--
-## Tests
-
+Use the `var` keyword to create a variable called `myName`.
-```yml
-tests:
- - text: You should declare myName with the var keyword, ending with a semicolon
- testString: assert(/var\s+myName\s*;/.test(code));
+**Hint**
+Look at the `ourName` example above if you get stuck.
-```
+# --hints--
-
-
-## Challenge Seed
-
-
-
+You should declare `myName` with the `var` keyword, ending with a semicolon
```js
-
-
+assert(/var\s+myName\s*;/.test(code));
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+```
+# --solutions--
```js
var myName;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md
index a44abd5c09..9c60b5755d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md
@@ -6,64 +6,72 @@ videoUrl: 'https://scrimba.com/c/c2QvWU6'
forumTopicId: 17557
---
-## Description
-
+# --description--
+
Previously we have used the code
-var myName = "your name";
-"your name" is called a string literal. It is a string because it is a series of zero or more characters enclosed in single or double quotes.
-
-## Instructions
-
-Create two new string variables: myFirstName and myLastName and assign them the values of your first and last name, respectively.
-
+`var myName = "your name";`
-## Tests
-
+`"your name"` is called a string literal. It is a string because it is a series of zero or more characters enclosed in single or double quotes.
-```yml
-tests:
- - text: myFirstName should be a string with at least one character in it.
- testString: assert((function(){if(typeof myFirstName !== "undefined" && typeof myFirstName === "string" && myFirstName.length > 0){return true;}else{return false;}})());
- - text: myLastName should be a string with at least one character in it.
- testString: assert((function(){if(typeof myLastName !== "undefined" && typeof myLastName === "string" && myLastName.length > 0){return true;}else{return false;}})());
+# --instructions--
-```
+Create two new `string` variables: `myFirstName` and `myLastName` and assign them the values of your first and last name, respectively.
-
+# --hints--
-## Challenge Seed
-
-
-
+`myFirstName` should be a string with at least one character in it.
```js
-
-
-
+assert(
+ (function () {
+ if (
+ typeof myFirstName !== 'undefined' &&
+ typeof myFirstName === 'string' &&
+ myFirstName.length > 0
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })()
+);
```
-
+`myLastName` should be a string with at least one character in it.
+```js
+assert(
+ (function () {
+ if (
+ typeof myLastName !== 'undefined' &&
+ typeof myLastName === 'string' &&
+ myLastName.length > 0
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })()
+);
+```
-### After Test
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+```
+# --solutions--
```js
var myFirstName = "Alan";
var myLastName = "Turing";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
index 5cff4c6e9a..d3bf31f2f3 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
@@ -6,72 +6,71 @@ videoUrl: 'https://scrimba.com/c/cM2KeS2'
forumTopicId: 17558
---
-## Description
-
-You can easily decrement or decrease a variable by one with the -- operator.
-i--;
+# --description--
+
+You can easily decrement or decrease a variable by one with the `--` operator.
+
+`i--;`
+
is the equivalent of
-i = i - 1;
-Note The entire line becomes i--;, eliminating the need for the equal sign.
-
-## Instructions
-
-Change the code to use the -- operator on myVar.
-
+`i = i - 1;`
-## Tests
-
+**Note**
+The entire line becomes `i--;`, eliminating the need for the equal sign.
-```yml
-tests:
- - text: myVar should equal 10.
- testString: assert(myVar === 10);
- - text: myVar = myVar - 1; should be changed.
- testString: assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code));
- - text: You should use the -- operator on myVar.
- testString: assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
- - text: You should not change code above the specified comment.
- testString: assert(/var myVar = 11;/.test(code));
+# --instructions--
+Change the code to use the `--` operator on `myVar`.
+
+# --hints--
+
+`myVar` should equal `10`.
+
+```js
+assert(myVar === 10);
```
-
+`myVar = myVar - 1;` should be changed.
-## Challenge Seed
-
+```js
+assert(
+ /var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code)
+);
+```
-
+You should use the `--` operator on `myVar`.
+
+```js
+assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
+```
+
+You should not change code above the specified comment.
+
+```js
+assert(/var myVar = 11;/.test(code));
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(z){return 'myVar = ' + z;})(myVar);
+```
+
+## --seed-contents--
```js
var myVar = 11;
// Only change code below this line
myVar = myVar - 1;
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myVar = 11;
myVar--;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md
index 0b3a0ace7d..62c8d434e6 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cDqKdTv'
forumTopicId: 17560
---
-## Description
-
+# --description--
+
We can also delete properties from objects like this:
-delete ourDog.bark;
+
+`delete ourDog.bark;`
Example:
@@ -25,7 +26,7 @@ var ourDog = {
delete ourDog.bark;
```
-After the last line shown above, ourDog looks like:
+After the last line shown above, `ourDog` looks like:
```js
{
@@ -36,31 +37,33 @@ After the last line shown above, ourDog looks like:
}
```
-
+# --instructions--
-## Instructions
-
-Delete the "tails" property from myDog. You may use either dot or bracket notation.
-
+Delete the `"tails"` property from `myDog`. You may use either dot or bracket notation.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should delete the property "tails" from myDog.
- testString: assert(typeof myDog === "object" && myDog.tails === undefined);
- - text: You should not modify the myDog setup.
- testString: 'assert(code.match(/"tails": 1/g).length > 0);'
+You should delete the property `"tails"` from `myDog`.
+```js
+assert(typeof myDog === 'object' && myDog.tails === undefined);
```
-
+You should not modify the `myDog` setup.
-## Challenge Seed
-
+```js
+assert(code.match(/"tails": 1/g).length > 0);
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(z){return z;})(myDog);
+```
+
+## --seed-contents--
```js
// Setup
@@ -73,27 +76,9 @@ var myDog = {
};
// Only change code below this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myDog = {
@@ -105,5 +90,3 @@ var myDog = {
};
delete myDog.tails;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md
index 3843d4eb75..137c6ceb55 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md
@@ -6,60 +6,50 @@ videoUrl: 'https://scrimba.com/c/cBZe9AW'
forumTopicId: 18255
---
-## Description
-
+# --description--
+
Now let's divide one decimal by another.
-
-## Instructions
-
-Change the 0.0 so that quotient will equal to 2.2.
-
+# --instructions--
-## Tests
-
+Change the `0.0` so that `quotient` will equal to `2.2`.
-```yml
-tests:
- - text: The variable quotient should equal 2.2
- testString: assert(quotient === 2.2);
- - text: You should use the / operator to divide 4.4 by 2
- testString: assert(/4\.40*\s*\/\s*2\.*0*/.test(code));
- - text: The quotient variable should only be assigned once
- testString: assert(code.match(/quotient/g).length === 1);
+# --hints--
-```
-
-
-
-## Challenge Seed
-
-
-
+The variable `quotient` should equal `2.2`
```js
-var quotient = 0.0 / 2.0; // Change this line
+assert(quotient === 2.2);
```
-
+You should use the `/` operator to divide 4.4 by 2
+```js
+assert(/4\.40*\s*\/\s*2\.*0*/.test(code));
+```
-### After Test
-
+The quotient variable should only be assigned once
+
+```js
+assert(code.match(/quotient/g).length === 1);
+```
+
+# --seed--
+
+## --after-user-code--
```js
(function(y){return 'quotient = '+y;})(quotient);
```
-
+## --seed-contents--
-
+```js
+var quotient = 0.0 / 2.0; // Change this line
+```
-## Solution
-
+# --solutions--
```js
var quotient = 4.4 / 2.0;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md
index 4689fa67ce..879639d00d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md
@@ -6,70 +6,52 @@ videoUrl: 'https://scrimba.com/c/cqkbdAr'
forumTopicId: 17566
---
-## Description
-
-We can also divide one number by another.
-JavaScript uses the / symbol for division.
+# --description--
-Example
+We can also divide one number by another.
+
+JavaScript uses the `/` symbol for division.
+
+**Example**
```js
myVar = 16 / 2; // assigned 8
```
+# --instructions--
-
+Change the `0` so that the `quotient` is equal to `2`.
-## Instructions
-
-Change the 0 so that the quotient is equal to 2.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: The variable quotient should be equal to 2.
- testString: assert(quotient === 2);
- - text: You should use the / operator.
- testString: assert(/\d+\s*\/\s*\d+/.test(code));
-
-```
-
-
-
-## Challenge Seed
-
-
-
+The variable `quotient` should be equal to 2.
```js
-var quotient = 66 / 0;
-
-
+assert(quotient === 2);
```
-
+You should use the `/` operator.
+```js
+assert(/\d+\s*\/\s*\d+/.test(code));
+```
-### After Test
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var quotient = 66 / 0;
+```
+# --solutions--
```js
var quotient = 66 / 33;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md
index 4d7078f481..01e0024c63 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.md
@@ -6,62 +6,80 @@ videoUrl: 'https://scrimba.com/c/cvmqRh6'
forumTopicId: 17567
---
-## Description
-
-Quotes are not the only characters that can be escaped inside a string. There are two reasons to use escaping characters:
To allow you to use characters you may not otherwise be able to type out, such as a carriage return.
To allow you to represent multiple quotes in a string without JavaScript misinterpreting what you mean.
We learned this in the previous challenge.
-
Code
Output
\'
single quote
\"
double quote
\\
backslash
\n
newline
\r
carriage return
\t
tab
\b
word boundary
\f
form feed
-Note that the backslash itself must be escaped in order to display as a backslash.
-
+# --description--
+
+Quotes are not the only characters that can be escaped inside a string. There are two reasons to use escaping characters:
+
+1. To allow you to use characters you may not otherwise be able to type out, such as a carriage return.
+2. To allow you to represent multiple quotes in a string without JavaScript misinterpreting what you mean.
+
+We learned this in the previous challenge.
+
+
Code
Output
\'
single quote
\"
double quote
\\
backslash
\n
newline
\r
carriage return
\t
tab
\b
word boundary
\f
form feed
+
+*Note that the backslash itself must be escaped in order to display as a backslash.*
+
+# --instructions--
+
+Assign the following three lines of text into the single variable `myStr` using escape sequences.
+
+
FirstLine \SecondLine ThirdLine
-## Instructions
-
-Assign the following three lines of text into the single variable myStr using escape sequences.
-
FirstLine \SecondLine ThirdLine
You will need to use escape sequences to insert special characters correctly. You will also need to follow the spacing as it looks above, with no spaces between escape sequences or words.
+
Here is the text with the escape sequences written out.
-FirstLinenewlinetabbackslashSecondLinenewlineThirdLine
-
-## Tests
-
+"FirstLine```newline``tab``backslash```SecondLine`newline`ThirdLine"
-```yml
-tests:
- - text: myStr should not contain any spaces
- testString: assert(!/ /.test(myStr));
- - text: myStr should contain the strings FirstLine, SecondLine and ThirdLine (remember case sensitivity)
- testString: assert(/FirstLine/.test(myStr) && /SecondLine/.test(myStr) && /ThirdLine/.test(myStr));
- - text: FirstLine should be followed by the newline character \n
- testString: assert(/FirstLine\n/.test(myStr));
- - text: myStr should contain a tab character \t which follows a newline character
- testString: assert(/\n\t/.test(myStr));
- - text: SecondLine should be preceded by the backslash character \
- testString: assert(/\\SecondLine/.test(myStr));
- - text: There should be a newline character between SecondLine and ThirdLine
- testString: assert(/SecondLine\nThirdLine/.test(myStr));
- - text: myStr should only contain characters shown in the instructions
- testString: assert(myStr === 'FirstLine\n\t\\SecondLine\nThirdLine');
+# --hints--
-```
-
-
-
-## Challenge Seed
-
-
-
+`myStr` should not contain any spaces
```js
-var myStr; // Change this line
-
-
+assert(!/ /.test(myStr));
```
-
+`myStr` should contain the strings `FirstLine`, `SecondLine` and `ThirdLine` (remember case sensitivity)
+```js
+assert(
+ /FirstLine/.test(myStr) && /SecondLine/.test(myStr) && /ThirdLine/.test(myStr)
+);
+```
-### After Test
-
+`FirstLine` should be followed by the newline character `\n`
+
+```js
+assert(/FirstLine\n/.test(myStr));
+```
+
+`myStr` should contain a tab character `\t` which follows a newline character
+
+```js
+assert(/\n\t/.test(myStr));
+```
+
+`SecondLine` should be preceded by the backslash character `\`
+
+```js
+assert(/\\SecondLine/.test(myStr));
+```
+
+There should be a newline character between `SecondLine` and `ThirdLine`
+
+```js
+assert(/SecondLine\nThirdLine/.test(myStr));
+```
+
+`myStr` should only contain characters shown in the instructions
+
+```js
+assert(myStr === 'FirstLine\n\t\\SecondLine\nThirdLine');
+```
+
+# --seed--
+
+## --after-user-code--
```js
(function(){
@@ -69,16 +87,14 @@ if (myStr !== undefined){
console.log('myStr:\n' + myStr);}})();
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var myStr; // Change this line
+```
+# --solutions--
```js
var myStr = "FirstLine\n\t\\SecondLine\nThirdLine";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md
index 3ac1b05d79..76e023fc2c 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md
@@ -6,51 +6,41 @@ videoUrl: 'https://scrimba.com/c/c2QvgSr'
forumTopicId: 17568
---
-## Description
-
-When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: " or ' inside of your string?
-In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash (\) in front of the quote.
-var sampleStr = "Alan said, \"Peter is learning JavaScript\".";
+# --description--
+
+When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: `"` or `'` inside of your string?
+
+In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash (`\`) in front of the quote.
+
+`var sampleStr = "Alan said, \"Peter is learning JavaScript\".";`
+
This signals to JavaScript that the following quote is not the end of the string, but should instead appear inside the string. So if you were to print this to the console, you would get:
-Alan said, "Peter is learning JavaScript".
-
-## Instructions
-
-Use backslashes to assign a string to the myStr variable so that if you were to print it to the console, you would see:
-I am a "double quoted" string inside "double quotes".
-
+`Alan said, "Peter is learning JavaScript".`
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: You should use two double quotes (") and four escaped double quotes (\").
- testString: assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2);
- - text: 'Variable myStr should contain the string: I am a "double quoted" string inside "double quotes".'
- testString: 'assert(myStr === "I am a \"double quoted\" string inside \"double quotes\".");'
+Use backslashes to assign a string to the `myStr` variable so that if you were to print it to the console, you would see:
-```
+`I am a "double quoted" string inside "double quotes".`
-
+# --hints--
-## Challenge Seed
-
-
-
+You should use two double quotes (`"`) and four escaped double quotes (`\"`).
```js
-var myStr = ""; // Change this line
-
-
+assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2);
```
-
+Variable myStr should contain the string: `I am a "double quoted" string inside "double quotes".`
+```js
+assert(myStr === 'I am a "double quoted" string inside "double quotes".');
+```
-### After Test
-
+# --seed--
+
+## --after-user-code--
```js
(function(){
@@ -62,16 +52,14 @@ var myStr = ""; // Change this line
})();
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var myStr = ""; // Change this line
+```
+# --solutions--
```js
var myStr = "I am a \"double quoted\" string inside \"double quotes\".";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md
index 14d5294b00..31a1fddeb5 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md
@@ -6,38 +6,44 @@ videoUrl: 'https://scrimba.com/c/cvmqEAd'
forumTopicId: 18182
---
-## Description
-
-You can find the length of a String value by writing .length after the string variable or string literal.
-"Alan Peter".length; // 10
-For example, if we created a variable var firstName = "Charles", we could find out how long the string "Charles" is by using the firstName.length property.
-
+# --description--
-## Instructions
-
-Use the .length property to count the number of characters in the lastName variable and assign it to lastNameLength.
-
+You can find the length of a `String` value by writing `.length` after the string variable or string literal.
-## Tests
-
+`"Alan Peter".length; // 10`
-```yml
-tests:
- - text: 'You should not change the variable declarations in the // Setup section.'
- testString: assert(code.match(/var lastNameLength = 0;/) && code.match(/var lastName = "Lovelace";/));
- - text: lastNameLength should be equal to eight.
- testString: assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8);
- - text: 'You should be getting the length of lastName by using .length like this: lastName.length.'
- testString: assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/));
+For example, if we created a variable `var firstName = "Charles"`, we could find out how long the string `"Charles"` is by using the `firstName.length` property.
+# --instructions--
+
+Use the `.length` property to count the number of characters in the `lastName` variable and assign it to `lastNameLength`.
+
+# --hints--
+
+You should not change the variable declarations in the `// Setup` section.
+
+```js
+assert(
+ code.match(/var lastNameLength = 0;/) &&
+ code.match(/var lastName = "Lovelace";/)
+);
```
-
+`lastNameLength` should be equal to eight.
-## Challenge Seed
-
+```js
+assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8);
+```
-
+You should be getting the length of `lastName` by using `.length` like this: `lastName.length`.
+
+```js
+assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/));
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -47,22 +53,12 @@ var lastName = "Lovelace";
// Only change code below this line
lastNameLength = lastName;
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var lastNameLength = 0;
var lastName = "Lovelace";
lastNameLength = lastName.length;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md
index dadba1b4dd..4f7d94a138 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md
@@ -6,69 +6,64 @@ videoUrl: 'https://scrimba.com/c/cWP24Ub'
forumTopicId: 18184
---
-## Description
-
-The remainder operator % gives the remainder of the division of two numbers.
-Example
+# --description--
+
+The remainder operator `%` gives the remainder of the division of two numbers.
+
+**Example**
+
-Usage In mathematics, a number can be checked to be even or odd by checking the remainder of the division of the number by 2.
+
+**Usage**
+In mathematics, a number can be checked to be even or odd by checking the remainder of the division of the number by `2`.
+
17 % 2 = 1 (17 is Odd) 48 % 2 = 0 (48 is Even)
-Note The remainder operator is sometimes incorrectly referred to as the "modulus" operator. It is very similar to modulus, but does not work properly with negative numbers.
-
-## Instructions
-
-Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.
-
+**Note**
+The remainder operator is sometimes incorrectly referred to as the "modulus" operator. It is very similar to modulus, but does not work properly with negative numbers.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: The variable remainder should be initialized
- testString: assert(/var\s+?remainder/.test(code));
- - text: The value of remainder should be 2
- testString: assert(remainder === 2);
- - text: You should use the % operator
- testString: assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code));
+Set `remainder` equal to the remainder of `11` divided by `3` using the remainder (`%`) operator.
-```
+# --hints--
-
-
-## Challenge Seed
-
-
-
+The variable `remainder` should be initialized
```js
-// Only change code below this line
-
-var remainder;
-
+assert(/var\s+?remainder/.test(code));
```
-
+The value of `remainder` should be `2`
+```js
+assert(remainder === 2);
+```
-### After Test
-
+You should use the `%` operator
+
+```js
+assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code));
+```
+
+# --seed--
+
+## --after-user-code--
```js
(function(y){return 'remainder = '+y;})(remainder);
```
-
+## --seed-contents--
-
+```js
+// Only change code below this line
-## Solution
-
+var remainder;
+```
+# --solutions--
```js
var remainder = 11 % 3;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md
index 411ac38343..3c7f7278cc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md
@@ -6,38 +6,48 @@ videoUrl: 'https://scrimba.com/c/cyWJJs3'
forumTopicId: 18185
---
-## Description
-
+# --description--
+
Random numbers are useful for creating random behavior.
-JavaScript has a Math.random() function that generates a random decimal number between 0 (inclusive) and not quite up to 1 (exclusive). Thus Math.random() can return a 0 but never quite return a 1
-Note Like Storing Values with the Equal Operator, all function calls will be resolved before the return executes, so we can return the value of the Math.random() function.
-
-## Instructions
-
-Change randomFraction to return a random number instead of returning 0.
-
+JavaScript has a `Math.random()` function that generates a random decimal number between `0` (inclusive) and not quite up to `1` (exclusive). Thus `Math.random()` can return a `0` but never quite return a `1`
-## Tests
-
+**Note**
+Like [Storing Values with the Equal Operator](/learn/javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator), all function calls will be resolved before the `return` executes, so we can `return` the value of the `Math.random()` function.
-```yml
-tests:
- - text: randomFraction should return a random number.
- testString: assert(typeof randomFraction() === "number");
- - text: The number returned by randomFraction should be a decimal.
- testString: assert((randomFraction()+''). match(/\./g));
- - text: You should be using Math.random to generate the random decimal number.
- testString: assert(code.match(/Math\.random/g).length >= 0);
+# --instructions--
+Change `randomFraction` to return a random number instead of returning `0`.
+
+# --hints--
+
+`randomFraction` should return a random number.
+
+```js
+assert(typeof randomFraction() === 'number');
```
-
+The number returned by `randomFraction` should be a decimal.
-## Challenge Seed
-
+```js
+assert((randomFraction() + '').match(/\./g));
+```
-
+You should be using `Math.random` to generate the random decimal number.
+
+```js
+assert(code.match(/Math\.random/g).length >= 0);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(){return randomFraction();})();
+```
+
+## --seed-contents--
```js
function randomFraction() {
@@ -50,28 +60,10 @@ function randomFraction() {
}
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function randomFraction() {
return Math.random();
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md
index 6b95d4dd17..c2d6435652 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md
@@ -6,43 +6,68 @@ videoUrl: 'https://scrimba.com/c/cRn6bfr'
forumTopicId: 18186
---
-## Description
-
+# --description--
+
It's great that we can generate random decimal numbers, but it's even more useful if we use it to generate random whole numbers.
+
Use Math.random() to generate a random decimal.
Multiply that random decimal by 20.
Use another function, Math.floor() to round the number down to its nearest whole number.
-Remember that Math.random() can never quite return a 1 and, because we're rounding down, it's impossible to actually get 20. This technique will give us a whole number between 0 and 19.
+
+Remember that `Math.random()` can never quite return a `1` and, because we're rounding down, it's impossible to actually get `20`. This technique will give us a whole number between `0` and `19`.
+
Putting everything together, this is what our code looks like:
-Math.floor(Math.random() * 20);
-We are calling Math.random(), multiplying the result by 20, then passing the value to Math.floor() function to round the value down to the nearest whole number.
-
-## Instructions
-
-Use this technique to generate and return a random whole number between 0 and 9.
-
+`Math.floor(Math.random() * 20);`
-## Tests
-
+We are calling `Math.random()`, multiplying the result by 20, then passing the value to `Math.floor()` function to round the value down to the nearest whole number.
-```yml
-tests:
- - text: The result of randomWholeNum should be a whole number.
- testString: assert(typeof randomWholeNum() === "number" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})());
- - text: You should use Math.random to generate a random number.
- testString: assert(code.match(/Math.random/g).length >= 1);
- - text: You should have multiplied the result of Math.random by 10 to make it a number that is between zero and nine.
- testString: assert(code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g));
- - text: You should use Math.floor to remove the decimal part of the number.
- testString: assert(code.match(/Math.floor/g).length >= 1);
+# --instructions--
+Use this technique to generate and return a random whole number between `0` and `9`.
+
+# --hints--
+
+The result of `randomWholeNum` should be a whole number.
+
+```js
+assert(
+ typeof randomWholeNum() === 'number' &&
+ (function () {
+ var r = randomWholeNum();
+ return Math.floor(r) === r;
+ })()
+);
```
-
+You should use `Math.random` to generate a random number.
-## Challenge Seed
-
+```js
+assert(code.match(/Math.random/g).length >= 1);
+```
-
+You should have multiplied the result of `Math.random` by 10 to make it a number that is between zero and nine.
+
+```js
+assert(
+ code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) ||
+ code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g)
+);
+```
+
+You should use `Math.floor` to remove the decimal part of the number.
+
+```js
+assert(code.match(/Math.floor/g).length >= 1);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(){return randomWholeNum();})();
+```
+
+## --seed-contents--
```js
function randomWholeNum() {
@@ -53,28 +78,10 @@ function randomWholeNum() {
}
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function randomWholeNum() {
return Math.floor(Math.random() * 10);
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md
index 6c9ef78a43..e01399e13c 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md
@@ -6,55 +6,62 @@ videoUrl: 'https://scrimba.com/c/cm83yu6'
forumTopicId: 18187
---
-## Description
-
+# --description--
+
Instead of generating a random whole number between zero and a given number like we did before, we can generate a random whole number that falls within a range of two specific numbers.
-To do this, we'll define a minimum number min and a maximum number max.
+
+To do this, we'll define a minimum number `min` and a maximum number `max`.
+
Here's the formula we'll use. Take a moment to read it and try to understand what this code is doing:
-Math.floor(Math.random() * (max - min + 1)) + min
-
-## Instructions
-
-Create a function called randomRange that takes a range myMin and myMax and returns a random whole number that's greater than or equal to myMin, and is less than or equal to myMax, inclusive.
-
+`Math.floor(Math.random() * (max - min + 1)) + min`
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: The lowest random number that can be generated by randomRange should be equal to your minimum number, myMin.
- testString: assert(calcMin === 5);
- - text: The highest random number that can be generated by randomRange should be equal to your maximum number, myMax.
- testString: assert(calcMax === 15);
- - text: The random number generated by randomRange should be an integer, not a decimal.
- testString: assert(randomRange(0,1) % 1 === 0 );
- - text: randomRange should use both myMax and myMin, and return a random number in your range.
- testString: assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})());
+Create a function called `randomRange` that takes a range `myMin` and `myMax` and returns a random whole number that's greater than or equal to `myMin`, and is less than or equal to `myMax`, inclusive.
-```
+# --hints--
-
-
-## Challenge Seed
-
-
-
+The lowest random number that can be generated by `randomRange` should be equal to your minimum number, `myMin`.
```js
-function randomRange(myMin, myMax) {
- // Only change code below this line
- return 0;
- // Only change code above this line
-}
+assert(calcMin === 5);
```
-
+The highest random number that can be generated by `randomRange` should be equal to your maximum number, `myMax`.
+```js
+assert(calcMax === 15);
+```
-### After Test
-
+The random number generated by `randomRange` should be an integer, not a decimal.
+
+```js
+assert(randomRange(0, 1) % 1 === 0);
+```
+
+`randomRange` should use both `myMax` and `myMin`, and return a random number in your range.
+
+```js
+assert(
+ (function () {
+ if (
+ code.match(/myMax/g).length > 1 &&
+ code.match(/myMin/g).length > 2 &&
+ code.match(/Math.floor/g) &&
+ code.match(/Math.random/g)
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })()
+);
+```
+
+# --seed--
+
+## --after-user-code--
```js
var calcMin = 100;
@@ -73,18 +80,20 @@ for(var i = 0; i < 100; i++) {
})()
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+function randomRange(myMin, myMax) {
+ // Only change code below this line
+ return 0;
+ // Only change code above this line
+}
+```
+# --solutions--
```js
function randomRange(myMin, myMax) {
return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md
index 71f6a78f6a..618531b69f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md
@@ -6,68 +6,47 @@ videoUrl: 'https://scrimba.com/c/cQM7mCN'
forumTopicId: 18193
---
-## Description
-
+# --description--
+
In JavaScript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope. This means, they can be seen everywhere in your JavaScript code.
-Variables which are used without the var keyword are automatically created in the global scope. This can create unintended consequences elsewhere in your code or when running a function again. You should always declare your variables with var.
-
-## Instructions
-
-Using var, declare a global variable named myGlobal outside of any function. Initialize it with a value of 10.
-Inside function fun1, assign 5 to oopsGlobalwithout using the var keyword.
-
+Variables which are used without the `var` keyword are automatically created in the `global` scope. This can create unintended consequences elsewhere in your code or when running a function again. You should always declare your variables with `var`.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: myGlobal should be defined
- testString: assert(typeof myGlobal != "undefined");
- - text: myGlobal should have a value of 10
- testString: assert(myGlobal === 10);
- - text: myGlobal should be declared using the var keyword
- testString: assert(/var\s+myGlobal/.test(code));
- - text: oopsGlobal should be a global variable and have a value of 5
- testString: assert(typeof oopsGlobal != "undefined" && oopsGlobal === 5);
+Using `var`, declare a global variable named `myGlobal` outside of any function. Initialize it with a value of `10`.
-```
+Inside function `fun1`, assign `5` to `oopsGlobal` ***without*** using the `var` keyword.
-
+# --hints--
-## Challenge Seed
-
-
-
+`myGlobal` should be defined
```js
-// Declare the myGlobal variable below this line
-
-
-function fun1() {
- // Assign 5 to oopsGlobal Here
-
-}
-
-// Only change code above this line
-
-function fun2() {
- var output = "";
- if (typeof myGlobal != "undefined") {
- output += "myGlobal: " + myGlobal;
- }
- if (typeof oopsGlobal != "undefined") {
- output += " oopsGlobal: " + oopsGlobal;
- }
- console.log(output);
-}
+assert(typeof myGlobal != 'undefined');
```
-
+`myGlobal` should have a value of `10`
-### Before Test
-
+```js
+assert(myGlobal === 10);
+```
+
+`myGlobal` should be declared using the `var` keyword
+
+```js
+assert(/var\s+myGlobal/.test(code));
+```
+
+`oopsGlobal` should be a global variable and have a value of `5`
+
+```js
+assert(typeof oopsGlobal != 'undefined' && oopsGlobal === 5);
+```
+
+# --seed--
+
+## --before-user-code--
```js
var logOutput = "";
@@ -92,10 +71,7 @@ var oopsGlobal;
capture();
```
-
+## --seed-contents--
-
+```js
+// Declare the myGlobal variable below this line
-## Solution
-
+function fun1() {
+ // Assign 5 to oopsGlobal Here
+
+}
+
+// Only change code above this line
+
+function fun2() {
+ var output = "";
+ if (typeof myGlobal != "undefined") {
+ output += "myGlobal: " + myGlobal;
+ }
+ if (typeof oopsGlobal != "undefined") {
+ output += " oopsGlobal: " + oopsGlobal;
+ }
+ console.log(output);
+}
+```
+
+# --solutions--
```js
var myGlobal = 10;
@@ -130,5 +125,3 @@ function fun2() {
console.log(output);
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md
index 5424e40ed7..edfee1da60 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/c2QwKH2'
forumTopicId: 18194
---
-## Description
-
-It is possible to have both local and global variables with the same name. When you do this, the local variable takes precedence over the global variable.
+# --description--
+
+It is possible to have both local and global variables with the same name. When you do this, the `local` variable takes precedence over the `global` variable.
+
In this example:
```js
@@ -19,34 +20,35 @@ function myFun() {
}
```
-The function myFun will return "Head" because the local version of the variable is present.
-
+The function `myFun` will return `"Head"` because the `local` version of the variable is present.
-## Instructions
-
-Add a local variable to myOutfit function to override the value of outerWear with "sweater".
-
+# --instructions--
-## Tests
-
+Add a local variable to `myOutfit` function to override the value of `outerWear` with `"sweater"`.
-```yml
-tests:
- - text: You should not change the value of the global outerWear.
- testString: assert(outerWear === "T-Shirt");
- - text: myOutfit should return "sweater".
- testString: assert(myOutfit() === "sweater");
- - text: You should not change the return statement.
- testString: assert(/return outerWear/.test(code));
+# --hints--
+You should not change the value of the global `outerWear`.
+
+```js
+assert(outerWear === 'T-Shirt');
```
-
+`myOutfit` should return `"sweater"`.
-## Challenge Seed
-
+```js
+assert(myOutfit() === 'sweater');
+```
-
+You should not change the return statement.
+
+```js
+assert(/return outerWear/.test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -64,15 +66,7 @@ function myOutfit() {
myOutfit();
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var outerWear = "T-Shirt";
@@ -81,5 +75,3 @@ function myOutfit() {
return outerWear;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md
index 7c62d6c5b5..74890fc3f4 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.md
@@ -6,55 +6,87 @@ videoUrl: 'https://scrimba.com/c/c9ykNUR'
forumTopicId: 18195
---
-## Description
-
-In the game of golf each hole has a par meaning the average number of strokes a golfer is expected to make in order to sink the ball in a hole to complete the play. Depending on how far above or below par your strokes are, there is a different nickname.
-Your function will be passed par and strokes arguments. Return the correct string according to this table which lists the strokes in order of priority; top (highest) to bottom (lowest):
-
Strokes
Return
1
"Hole-in-one!"
<= par - 2
"Eagle"
par - 1
"Birdie"
par
"Par"
par + 1
"Bogey"
par + 2
"Double Bogey"
>= par + 3
"Go Home!"
-par and strokes will always be numeric and positive. We have added an array of all the names for your convenience.
-
+# --description--
-## Instructions
-
+In the game of [golf](https://en.wikipedia.org/wiki/Golf) each hole has a `par` meaning the average number of `strokes` a golfer is expected to make in order to sink the ball in a hole to complete the play. Depending on how far above or below `par` your `strokes` are, there is a different nickname.
-
+Your function will be passed `par` and `strokes` arguments. Return the correct string according to this table which lists the strokes in order of priority; top (highest) to bottom (lowest):
-## Tests
-
+
Strokes
Return
1
"Hole-in-one!"
<= par - 2
"Eagle"
par - 1
"Birdie"
par
"Par"
par + 1
"Bogey"
par + 2
"Double Bogey"
>= par + 3
"Go Home!"
-```yml
-tests:
- - text: golfScore(4, 1) should return "Hole-in-one!"
- testString: assert(golfScore(4, 1) === "Hole-in-one!");
- - text: golfScore(4, 2) should return "Eagle"
- testString: assert(golfScore(4, 2) === "Eagle");
- - text: golfScore(5, 2) should return "Eagle"
- testString: assert(golfScore(5, 2) === "Eagle");
- - text: golfScore(4, 3) should return "Birdie"
- testString: assert(golfScore(4, 3) === "Birdie");
- - text: golfScore(4, 4) should return "Par"
- testString: assert(golfScore(4, 4) === "Par");
- - text: golfScore(1, 1) should return "Hole-in-one!"
- testString: assert(golfScore(1, 1) === "Hole-in-one!");
- - text: golfScore(5, 5) should return "Par"
- testString: assert(golfScore(5, 5) === "Par");
- - text: golfScore(4, 5) should return "Bogey"
- testString: assert(golfScore(4, 5) === "Bogey");
- - text: golfScore(4, 6) should return "Double Bogey"
- testString: assert(golfScore(4, 6) === "Double Bogey");
- - text: golfScore(4, 7) should return "Go Home!"
- testString: assert(golfScore(4, 7) === "Go Home!");
- - text: golfScore(5, 9) should return "Go Home!"
- testString: assert(golfScore(5, 9) === "Go Home!");
+`par` and `strokes` will always be numeric and positive. We have added an array of all the names for your convenience.
+# --hints--
+
+`golfScore(4, 1)` should return "Hole-in-one!"
+
+```js
+assert(golfScore(4, 1) === 'Hole-in-one!');
```
-
+`golfScore(4, 2)` should return "Eagle"
-## Challenge Seed
-
+```js
+assert(golfScore(4, 2) === 'Eagle');
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function golfScore(par, strokes) {
@@ -108,5 +132,3 @@ function golfScore(par, strokes) {
return "Go Home!";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md
index 53a0415397..59346ae0f5 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md
@@ -6,72 +6,71 @@ videoUrl: 'https://scrimba.com/c/ca8GLT9'
forumTopicId: 18201
---
-## Description
-
-You can easily increment or add one to a variable with the ++ operator.
-i++;
+# --description--
+
+You can easily increment or add one to a variable with the `++` operator.
+
+`i++;`
+
is the equivalent of
-i = i + 1;
-Note The entire line becomes i++;, eliminating the need for the equal sign.
-
-## Instructions
-
-Change the code to use the ++ operator on myVar.
-
+`i = i + 1;`
-## Tests
-
+**Note**
+The entire line becomes `i++;`, eliminating the need for the equal sign.
-```yml
-tests:
- - text: myVar should equal 88.
- testString: assert(myVar === 88);
- - text: You should not use the assignment operator.
- testString: assert(/var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code));
- - text: You should use the ++ operator.
- testString: assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code));
- - text: You should not change code above the specified comment.
- testString: assert(/var myVar = 87;/.test(code));
+# --instructions--
+Change the code to use the `++` operator on `myVar`.
+
+# --hints--
+
+`myVar` should equal `88`.
+
+```js
+assert(myVar === 88);
```
-
+You should not use the assignment operator.
-## Challenge Seed
-
+```js
+assert(
+ /var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code)
+);
+```
-
+You should use the `++` operator.
+
+```js
+assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code));
+```
+
+You should not change code above the specified comment.
+
+```js
+assert(/var myVar = 87;/.test(code));
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(z){return 'myVar = ' + z;})(myVar);
+```
+
+## --seed-contents--
```js
var myVar = 87;
// Only change code below this line
myVar = myVar + 1;
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myVar = 87;
myVar++;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md
index 8cdbd7a8da..9423a7ce5d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md
@@ -6,60 +6,41 @@ videoUrl: 'https://scrimba.com/c/cWJ4Bfb'
forumTopicId: 301171
---
-## Description
-
+# --description--
+
It is common to initialize a variable to an initial value in the same line as it is declared.
-var myVar = 0;
-Creates a new variable called myVar and assigns it an initial value of 0.
-
-## Instructions
-
-Define a variable a with var and initialize it to a value of 9.
-
+`var myVar = 0;`
-## Tests
-
+Creates a new variable called `myVar` and assigns it an initial value of `0`.
-```yml
-tests:
- - text: You should initialize a to a value of 9.
- testString: assert(/var\s+a\s*=\s*9\s*/.test(code));
+# --instructions--
-```
+Define a variable `a` with `var` and initialize it to a value of `9`.
-
+# --hints--
-## Challenge Seed
-
-
-
+You should initialize `a` to a value of `9`.
```js
-
-
+assert(/var\s+a\s*=\s*9\s*/.test(code));
```
-
+# --seed--
-
-### After Test
-
+## --after-user-code--
```js
if(typeof a !== 'undefined') {(function(a){return "a = " + a;})(a);} else { (function() {return 'a is undefined';})(); }
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+```
+# --solutions--
```js
var a = 9;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md
index 307460fbcf..b650535f7b 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/caeJ2hm'
forumTopicId: 18206
---
-## Description
-
-If you have multiple conditions that need to be addressed, you can chain if statements together with else if statements.
+# --description--
+
+If you have multiple conditions that need to be addressed, you can chain `if` statements together with `else if` statements.
```js
if (num > 15) {
@@ -20,43 +20,67 @@ if (num > 15) {
}
```
-
+# --instructions--
-## Instructions
-
-Convert the logic to use else if statements.
-
+Convert the logic to use `else if` statements.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should have at least two else statements
- testString: assert(code.match(/else/g).length > 1);
- - text: You should have at least two if statements
- testString: assert(code.match(/if/g).length > 1);
- - text: You should have closing and opening curly braces for each if else code block.
- testString: assert(code.match(/if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/));
- - text: testElseIf(0) should return "Smaller than 5"
- testString: assert(testElseIf(0) === "Smaller than 5");
- - text: testElseIf(5) should return "Between 5 and 10"
- testString: assert(testElseIf(5) === "Between 5 and 10");
- - text: testElseIf(7) should return "Between 5 and 10"
- testString: assert(testElseIf(7) === "Between 5 and 10");
- - text: testElseIf(10) should return "Between 5 and 10"
- testString: assert(testElseIf(10) === "Between 5 and 10");
- - text: testElseIf(12) should return "Greater than 10"
- testString: assert(testElseIf(12) === "Greater than 10");
+You should have at least two `else` statements
+```js
+assert(code.match(/else/g).length > 1);
```
-
+You should have at least two `if` statements
-## Challenge Seed
-
+```js
+assert(code.match(/if/g).length > 1);
+```
-
+You should have closing and opening curly braces for each `if else` code block.
+
+```js
+assert(
+ code.match(
+ /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/
+ )
+);
+```
+
+`testElseIf(0)` should return "Smaller than 5"
+
+```js
+assert(testElseIf(0) === 'Smaller than 5');
+```
+
+`testElseIf(5)` should return "Between 5 and 10"
+
+```js
+assert(testElseIf(5) === 'Between 5 and 10');
+```
+
+`testElseIf(7)` should return "Between 5 and 10"
+
+```js
+assert(testElseIf(7) === 'Between 5 and 10');
+```
+
+`testElseIf(10)` should return "Between 5 and 10"
+
+```js
+assert(testElseIf(10) === 'Between 5 and 10');
+```
+
+`testElseIf(12)` should return "Greater than 10"
+
+```js
+assert(testElseIf(12) === 'Greater than 10');
+```
+
+# --seed--
+
+## --seed-contents--
```js
function testElseIf(val) {
@@ -72,18 +96,9 @@ function testElseIf(val) {
}
testElseIf(7);
-
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testElseIf(val) {
@@ -96,5 +111,3 @@ function testElseIf(val) {
}
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md
index 56b3742686..429ed73f22 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/cek4Efq'
forumTopicId: 18207
---
-## Description
-
-When a condition for an if statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an else statement, an alternate block of code can be executed.
+# --description--
+
+When a condition for an `if` statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an `else` statement, an alternate block of code can be executed.
```js
if (num > 10) {
@@ -18,41 +18,57 @@ if (num > 10) {
}
```
-
+# --instructions--
-## Instructions
-
-Combine the if statements into a single if/else statement.
-
+Combine the `if` statements into a single `if/else` statement.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should only have one if statement in the editor
- testString: assert(code.match(/if/g).length === 1);
- - text: You should use an else statement
- testString: assert(/else/g.test(code));
- - text: testElse(4) should return "5 or Smaller"
- testString: assert(testElse(4) === "5 or Smaller");
- - text: testElse(5) should return "5 or Smaller"
- testString: assert(testElse(5) === "5 or Smaller");
- - text: testElse(6) should return "Bigger than 5"
- testString: assert(testElse(6) === "Bigger than 5");
- - text: testElse(10) should return "Bigger than 5".
- testString: assert(testElse(10) === "Bigger than 5");
- - text: You should not change the code above or below the specified comments.
- testString: assert(/var result = "";/.test(code) && /return result;/.test(code));
+You should only have one `if` statement in the editor
+```js
+assert(code.match(/if/g).length === 1);
```
-
+You should use an `else` statement
-## Challenge Seed
-
+```js
+assert(/else/g.test(code));
+```
-
+`testElse(4)` should return "5 or Smaller"
+
+```js
+assert(testElse(4) === '5 or Smaller');
+```
+
+`testElse(5)` should return "5 or Smaller"
+
+```js
+assert(testElse(5) === '5 or Smaller');
+```
+
+`testElse(6)` should return "Bigger than 5"
+
+```js
+assert(testElse(6) === 'Bigger than 5');
+```
+
+`testElse(10)` should return "Bigger than 5".
+
+```js
+assert(testElse(10) === 'Bigger than 5');
+```
+
+You should not change the code above or below the specified comments.
+
+```js
+assert(/var result = "";/.test(code) && /return result;/.test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```js
function testElse(val) {
@@ -72,18 +88,9 @@ function testElse(val) {
}
testElse(4);
-
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function testElse(val) {
@@ -96,5 +103,3 @@ function testElse(val) {
return result;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md
index f46a9ae2e7..1cb25c8dfc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cm8n7T9'
forumTopicId: 18212
---
-## Description
-
-For loops don't have to iterate one at a time. By changing our final-expression, we can count by even numbers.
-We'll start at i = 0 and loop while i < 10. We'll increment i by 2 each loop with i += 2.
+# --description--
+
+For loops don't have to iterate one at a time. By changing our `final-expression`, we can count by even numbers.
+
+We'll start at `i = 0` and loop while `i < 10`. We'll increment `i` by 2 each loop with `i += 2`.
```js
var ourArray = [];
@@ -18,60 +19,44 @@ for (var i = 0; i < 10; i += 2) {
}
```
-ourArray will now contain [0,2,4,6,8].
-Let's change our initialization so we can count by odd numbers.
-
+`ourArray` will now contain `[0,2,4,6,8]`. Let's change our `initialization` so we can count by odd numbers.
-## Instructions
-
-Push the odd numbers from 1 through 9 to myArray using a for loop.
-
+# --instructions--
-## Tests
-
+Push the odd numbers from 1 through 9 to `myArray` using a `for` loop.
-```yml
-tests:
- - text: You should be using a for loop for this.
- testString: assert(/for\s*\([^)]+?\)/.test(code));
- - text: myArray should equal [1,3,5,7,9].
- testString: assert.deepEqual(myArray, [1,3,5,7,9]);
+# --hints--
+You should be using a `for` loop for this.
+
+```js
+assert(/for\s*\([^)]+?\)/.test(code));
```
-
+`myArray` should equal `[1,3,5,7,9]`.
-## Challenge Seed
-
+```js
+assert.deepEqual(myArray, [1, 3, 5, 7, 9]);
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+if(typeof myArray !== "undefined"){(function(){return myArray;})();}
+```
+
+## --seed-contents--
```js
// Setup
var myArray = [];
// Only change code below this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [];
@@ -79,5 +64,3 @@ for (var i = 1; i < 10; i += 2) {
myArray.push(i);
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md
index acd6d4e5b0..c498507f32 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/caeR3HB'
forumTopicId: 18216
---
-## Description
-
-A common task in JavaScript is to iterate through the contents of an array. One way to do that is with a for loop. This code will output each element of the array arr to the console:
+# --description--
+
+A common task in JavaScript is to iterate through the contents of an array. One way to do that is with a `for` loop. This code will output each element of the array `arr` to the console:
```js
var arr = [10, 9, 8, 7, 6];
@@ -17,59 +17,56 @@ for (var i = 0; i < arr.length; i++) {
}
```
-Remember that arrays have zero-based indexing, which means the last index of the array is length - 1. Our condition for this loop is i < arr.length, which stops the loop when i is equal to length. In this case the last iteration is i === 4 i.e. when i becomes equal to arr.length and outputs 6 to the console.
-
+Remember that arrays have zero-based indexing, which means the last index of the array is `length - 1`. Our condition for this loop is `i < arr.length`, which stops the loop when `i` is equal to `length`. In this case the last iteration is `i === 4` i.e. when `i` becomes equal to `arr.length` and outputs `6` to the console.
-## Instructions
-
-Declare and initialize a variable total to 0. Use a for loop to add the value of each element of the myArr array to total.
-
+# --instructions--
-## Tests
-
+Declare and initialize a variable `total` to `0`. Use a `for` loop to add the value of each element of the `myArr` array to `total`.
-```yml
-tests:
- - text: total should be declared and initialized to 0.
- testString: assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/));
- - text: total should equal 20.
- testString: assert(total === 20);
- - text: You should use a for loop to iterate through myArr.
- testString: assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code));
- - text: You should not attempt to directly assign the value 20 to total.
- testString: assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm));
+# --hints--
+
+`total` should be declared and initialized to 0.
+
+```js
+assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/));
```
-
+`total` should equal 20.
-## Challenge Seed
-
-
+```js
+assert(total === 20);
+```
+
+You should use a `for` loop to iterate through `myArr`.
+
+```js
+assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code));
+```
+
+You should not attempt to directly assign the value 20 to `total`.
+
+```js
+assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm));
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(){if(typeof total !== 'undefined') { return "total = " + total; } else { return "total is undefined";}})()
+```
+
+## --seed-contents--
```js
// Setup
var myArr = [ 2, 3, 4, 5, 6];
// Only change code below this line
-
```
-
-
-
-
-## Solution
-
+# --solutions--
```js
var myArr = [ 2, 3, 4, 5, 6];
@@ -79,5 +76,3 @@ for (var i = 0; i < myArr.length; i++) {
total += myArr[i];
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md
index de3e8d7245..ea7ae3b5d8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/cDqWGcp'
forumTopicId: 301172
---
-## Description
-
-The next type of loop you will learn is called a do...while loop. It is called a do...while loop because it will first do one pass of the code inside the loop no matter what, and then continue to run the loop while the specified condition evaluates to true.
+# --description--
+
+The next type of loop you will learn is called a `do...while` loop. It is called a `do...while` loop because it will first `do` one pass of the code inside the loop no matter what, and then continue to run the loop `while` the specified condition evaluates to `true`.
```js
var ourArray = [];
@@ -19,8 +19,7 @@ do {
} while (i < 5);
```
-The example above behaves similar to other types of loops, and the resulting array will look like [0, 1, 2, 3, 4]. However, what makes the do...while different from other loops is how it behaves when the condition fails on the first check. Let's see this in action:
-Here is a regular while loop that will run the code in the loop as long as i < 5:
+The example above behaves similar to other types of loops, and the resulting array will look like `[0, 1, 2, 3, 4]`. However, what makes the `do...while` different from other loops is how it behaves when the condition fails on the first check. Let's see this in action: Here is a regular `while` loop that will run the code in the loop as long as `i < 5`:
```js
var ourArray = [];
@@ -31,8 +30,7 @@ while (i < 5) {
}
```
-In this example, we initialize the value of ourArray to an empty array and the value of i to 5. When we execute the while loop, the condition evaluates to false because i is not less than 5, so we do not execute the code inside the loop. The result is that ourArray will end up with no values added to it, and it will still look like [] when all of the code in the example above has completed running.
-Now, take a look at a do...while loop:
+In this example, we initialize the value of `ourArray` to an empty array and the value of `i` to 5. When we execute the `while` loop, the condition evaluates to `false` because `i` is not less than 5, so we do not execute the code inside the loop. The result is that `ourArray` will end up with no values added to it, and it will still look like `[]` when all of the code in the example above has completed running. Now, take a look at a `do...while` loop:
```js
var ourArray = [];
@@ -43,35 +41,41 @@ do {
} while (i < 5);
```
-In this case, we initialize the value of i to 5, just like we did with the while loop. When we get to the next line, there is no condition to evaluate, so we go to the code inside the curly braces and execute it. We will add a single element to the array and then increment i before we get to the condition check. When we finally evaluate the condition i < 5 on the last line, we see that i is now 6, which fails the conditional check, so we exit the loop and are done. At the end of the above example, the value of ourArray is [5].
-Essentially, a do...while loop ensures that the code inside the loop will run at least once.
-Let's try getting a do...while loop to work by pushing values to an array.
-
+In this case, we initialize the value of `i` to 5, just like we did with the `while` loop. When we get to the next line, there is no condition to evaluate, so we go to the code inside the curly braces and execute it. We will add a single element to the array and then increment `i` before we get to the condition check. When we finally evaluate the condition `i < 5` on the last line, we see that `i` is now 6, which fails the conditional check, so we exit the loop and are done. At the end of the above example, the value of `ourArray` is `[5]`. Essentially, a `do...while` loop ensures that the code inside the loop will run at least once. Let's try getting a `do...while` loop to work by pushing values to an array.
-## Instructions
-
-Change the while loop in the code to a do...while loop so the loop will push only the number 10 to myArray, and i will be equal to 11 when your code has finished running.
-
+# --instructions--
-## Tests
-
+Change the `while` loop in the code to a `do...while` loop so the loop will push only the number `10` to `myArray`, and `i` will be equal to `11` when your code has finished running.
-```yml
-tests:
- - text: You should be using a do...while loop for this exercise.
- testString: assert(code.match(/do/g));
- - text: myArray should equal [10].
- testString: assert.deepEqual(myArray, [10]);
- - text: i should equal 11
- testString: assert.equal(i, 11);
+# --hints--
+
+You should be using a `do...while` loop for this exercise.
+
+```js
+assert(code.match(/do/g));
```
-
+`myArray` should equal `[10]`.
-## Challenge Seed
-
+```js
+assert.deepEqual(myArray, [10]);
+```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [];
@@ -111,5 +99,3 @@ do {
i++;
} while (i < 5)
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md
index 14681be5b5..2c0807eee2 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md
@@ -6,16 +6,23 @@ videoUrl: 'https://scrimba.com/c/c9yNVCe'
forumTopicId: 18219
---
-## Description
-
+# --description--
+
You can run the same code multiple times by using a loop.
-The most common type of JavaScript loop is called a for loop because it runs "for" a specific number of times.
+
+The most common type of JavaScript loop is called a `for` loop because it runs "for" a specific number of times.
+
For loops are declared with three optional expressions separated by semicolons:
-for ([initialization]; [condition]; [final-expression])
-The initialization statement is executed one time only before the loop starts. It is typically used to define and setup your loop variable.
-The condition statement is evaluated at the beginning of every loop iteration and will continue as long as it evaluates to true. When condition is false at the start of the iteration, the loop will stop executing. This means if condition starts as false, your loop will never execute.
-The final-expression is executed at the end of each loop iteration, prior to the next condition check and is usually used to increment or decrement your loop counter.
-In the following example we initialize with i = 0 and iterate while our condition i < 5 is true. We'll increment i by 1 in each loop iteration with i++ as our final-expression.
+
+`for ([initialization]; [condition]; [final-expression])`
+
+The `initialization` statement is executed one time only before the loop starts. It is typically used to define and setup your loop variable.
+
+The `condition` statement is evaluated at the beginning of every loop iteration and will continue as long as it evaluates to `true`. When `condition` is `false` at the start of the iteration, the loop will stop executing. This means if `condition` starts as `false`, your loop will never execute.
+
+The `final-expression` is executed at the end of each loop iteration, prior to the next `condition` check and is usually used to increment or decrement your loop counter.
+
+In the following example we initialize with `i = 0` and iterate while our condition `i < 5` is true. We'll increment `i` by `1` in each loop iteration with `i++` as our `final-expression`.
```js
var ourArray = [];
@@ -24,59 +31,44 @@ for (var i = 0; i < 5; i++) {
}
```
-ourArray will now contain [0,1,2,3,4].
-
+`ourArray` will now contain `[0,1,2,3,4]`.
-## Instructions
-
-Use a for loop to work to push the values 1 through 5 onto myArray.
-
+# --instructions--
-## Tests
-
+Use a `for` loop to work to push the values 1 through 5 onto `myArray`.
-```yml
-tests:
- - text: You should be using a for loop for this.
- testString: assert(/for\s*\([^)]+?\)/.test(code));
- - text: myArray should equal [1,2,3,4,5].
- testString: assert.deepEqual(myArray, [1,2,3,4,5]);
+# --hints--
+You should be using a `for` loop for this.
+
+```js
+assert(/for\s*\([^)]+?\)/.test(code));
```
-
+`myArray` should equal `[1,2,3,4,5]`.
-## Challenge Seed
-
+```js
+assert.deepEqual(myArray, [1, 2, 3, 4, 5]);
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+if (typeof myArray !== "undefined"){(function(){return myArray;})();}
+```
+
+## --seed-contents--
```js
// Setup
var myArray = [];
// Only change code below this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [];
@@ -84,5 +76,3 @@ for (var i = 1; i < 6; i++) {
myArray.push(i);
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md
index ff3250966c..712c73fc47 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/c8QbnCM'
forumTopicId: 18220
---
-## Description
-
+# --description--
+
You can run the same code multiple times by using a loop.
-The first type of loop we will learn is called a while loop because it runs "while" a specified condition is true and stops once that condition is no longer true.
+
+The first type of loop we will learn is called a `while` loop because it runs "while" a specified condition is true and stops once that condition is no longer true.
```js
var ourArray = [];
@@ -20,61 +21,46 @@ while(i < 5) {
}
```
-In the code example above, the while loop will execute 5 times and append the numbers 0 through 4 to ourArray.
+In the code example above, the `while` loop will execute 5 times and append the numbers 0 through 4 to `ourArray`.
Let's try getting a while loop to work by pushing values to an array.
-
-## Instructions
-
-Add the numbers 5 through 0 (inclusive) in descending order to myArray using a while loop.
-
+# --instructions--
-## Tests
-
+Add the numbers 5 through 0 (inclusive) in descending order to `myArray` using a `while` loop.
-```yml
-tests:
- - text: You should be using a while loop for this.
- testString: assert(code.match(/while/g));
- - text: myArray should equal [5,4,3,2,1,0].
- testString: assert.deepEqual(myArray, [5,4,3,2,1,0]);
+# --hints--
+You should be using a `while` loop for this.
+
+```js
+assert(code.match(/while/g));
```
-
+`myArray` should equal `[5,4,3,2,1,0]`.
-## Challenge Seed
-
+```js
+assert.deepEqual(myArray, [5, 4, 3, 2, 1, 0]);
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+if(typeof myArray !== "undefined"){(function(){return myArray;})();}
+```
+
+## --seed-contents--
```js
// Setup
var myArray = [];
// Only change code below this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [];
@@ -84,5 +70,3 @@ while(i >= 0) {
i--;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md
index 6a7aed09f3..7e33e7db68 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cd62NhM'
forumTopicId: 18227
---
-## Description
-
+# --description--
+
Variables which are declared within a function, as well as the function parameters have local scope. That means, they are only visible within that function.
-Here is a function myTest with a local variable called loc.
+
+Here is a function `myTest` with a local variable called `loc`.
```js
function myTest() {
@@ -20,40 +21,38 @@ myTest(); // logs "foo"
console.log(loc); // loc is not defined
```
-loc is not defined outside of the function.
-
+`loc` is not defined outside of the function.
-## Instructions
-
+# --instructions--
-The editor has two `console.log`s to help you see what is happening. Check the console as you code to see how it changes. Declare a local variable `myVar` inside `myLocalScope` and run the tests.
+The editor has two `console.log`s to help you see what is happening. Check the console as you code to see how it changes. Declare a local variable `myVar` inside `myLocalScope` and run the tests.
**Note:** The console will still have 'ReferenceError: myVar is not defined', but this will not cause the tests to fail.
-
-## Tests
-
-
-```yml
-tests:
- - text: The code should not contain a global myVar variable.
- testString: |
- function declared(){
- myVar;
- }
- assert.throws(declared, ReferenceError);
- - text: You should add a local myVar variable.
- testString: assert(/functionmyLocalScope\(\)\{.+(var|let|const)myVar[\s\S]*}/.test(__helpers.removeWhiteSpace(code)));
+# --hints--
+The code should not contain a global `myVar` variable.
+```js
+function declared() {
+ myVar;
+}
+assert.throws(declared, ReferenceError);
```
-
+You should add a local `myVar` variable.
-## Challenge Seed
-
+```js
+assert(
+ /functionmyLocalScope\(\)\{.+(var|let|const)myVar[\s\S]*}/.test(
+ __helpers.removeWhiteSpace(code)
+ )
+);
+```
-
+# --seed--
+
+## --seed-contents--
```js
function myLocalScope() {
@@ -67,16 +66,9 @@ myLocalScope();
// Run and check the console
// myVar is not defined outside of myLocalScope
console.log('outside myLocalScope', myVar);
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function myLocalScope() {
@@ -90,7 +82,4 @@ myLocalScope();
// Run and check the console
// myVar is not defined outside of myLocalScope
console.log('outside myLocalScope', myVar);
-
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.md
index d8f0835703..26c6b28207 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.md
@@ -6,11 +6,14 @@ videoUrl: 'https://scrimba.com/c/cwNvMUV'
forumTopicId: 18228
---
-## Description
-
-Order is important in if, else if statements.
+# --description--
+
+Order is important in `if`, `else if` statements.
+
The function is executed from top to bottom so you will want to be careful of what statement comes first.
+
Take these two functions as an example.
+
Here's the first:
```js
@@ -46,33 +49,33 @@ foo(0) // "Less than one"
bar(0) // "Less than two"
```
-
+# --instructions--
-## Instructions
-
Change the order of logic in the function so that it will return the correct statements in all cases.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: orderMyLogic(4) should return "Less than 5"
- testString: assert(orderMyLogic(4) === "Less than 5");
- - text: orderMyLogic(6) should return "Less than 10"
- testString: assert(orderMyLogic(6) === "Less than 10");
- - text: orderMyLogic(11) should return "Greater than or equal to 10"
- testString: assert(orderMyLogic(11) === "Greater than or equal to 10");
+`orderMyLogic(4)` should return "Less than 5"
+```js
+assert(orderMyLogic(4) === 'Less than 5');
```
-
+`orderMyLogic(6)` should return "Less than 10"
-## Challenge Seed
-
+```js
+assert(orderMyLogic(6) === 'Less than 10');
+```
-
+`orderMyLogic(11)` should return "Greater than or equal to 10"
+
+```js
+assert(orderMyLogic(11) === 'Greater than or equal to 10');
+```
+
+# --seed--
+
+## --seed-contents--
```js
function orderMyLogic(val) {
@@ -88,15 +91,7 @@ function orderMyLogic(val) {
orderMyLogic(7);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function orderMyLogic(val) {
@@ -109,5 +104,3 @@ function orderMyLogic(val) {
}
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md
index 5a7a14215d..f0a6ba635a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md
@@ -6,10 +6,12 @@ videoUrl: 'https://scrimba.com/c/cRbVZAB'
forumTopicId: 18236
---
-## Description
-
-Another way to change the data in an array is with the .pop() function.
-.pop() is used to "pop" a value off of the end of an array. We can store this "popped off" value by assigning it to a variable. In other words, .pop() removes the last element from an array and returns that element.
+# --description--
+
+Another way to change the data in an array is with the `.pop()` function.
+
+`.pop()` is used to "pop" a value off of the end of an array. We can store this "popped off" value by assigning it to a variable. In other words, `.pop()` removes the last element from an array and returns that element.
+
Any type of entry can be "popped" off of an array - numbers, strings, even nested arrays.
```js
@@ -19,33 +21,55 @@ console.log(oneDown); // Returns 6
console.log(threeArr); // Returns [1, 4]
```
-
+# --instructions--
-## Instructions
-
-Use the .pop() function to remove the last item from myArray, assigning the "popped off" value to removedFromMyArray.
-
+Use the `.pop()` function to remove the last item from `myArray`, assigning the "popped off" value to `removedFromMyArray`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: myArray should only contain [["John", 23]].
- testString: assert((function(d){if(d[0][0] == 'John' && d[0][1] === 23 && d[1] == undefined){return true;}else{return false;}})(myArray));
- - text: You should use pop() on myArray.
- testString: assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code));
- - text: removedFromMyArray should only contain ["cat", 2].
- testString: assert((function(d){if(d[0] == 'cat' && d[1] === 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray));
+`myArray` should only contain `[["John", 23]]`.
+```js
+assert(
+ (function (d) {
+ if (d[0][0] == 'John' && d[0][1] === 23 && d[1] == undefined) {
+ return true;
+ } else {
+ return false;
+ }
+ })(myArray)
+);
```
-
+You should use `pop()` on `myArray`.
-## Challenge Seed
-
+```js
+assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code));
+```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [["John", 23], ["cat", 2]];
var removedFromMyArray = myArray.pop();
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md
index 48934342fa..4c57c0fc9d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cnqmVtJ'
forumTopicId: 18237
---
-## Description
-
-An easy way to append data to the end of an array is via the push() function.
-.push() takes one or more parameters and "pushes" them onto the end of the array.
+# --description--
+
+An easy way to append data to the end of an array is via the `push()` function.
+
+`.push()` takes one or more parameters and "pushes" them onto the end of the array.
Examples:
@@ -23,60 +24,53 @@ arr2.push(["happy", "joy"]);
// arr2 now equals ["Stimpson", "J", "cat", ["happy", "joy"]]
```
-
+# --instructions--
-## Instructions
-
-Push ["dog", 3] onto the end of the myArray variable.
-
+Push `["dog", 3]` onto the end of the `myArray` variable.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: myArray should now equal [["John", 23], ["cat", 2], ["dog", 3]].
- testString: assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] === 23 && d[2][0] == 'dog' && d[2][1] === 3 && d[2].length == 2){return true;}else{return false;}})(myArray));
+`myArray` should now equal `[["John", 23], ["cat", 2], ["dog", 3]]`.
+```js
+assert(
+ (function (d) {
+ if (
+ d[2] != undefined &&
+ d[0][0] == 'John' &&
+ d[0][1] === 23 &&
+ d[2][0] == 'dog' &&
+ d[2][1] === 3 &&
+ d[2].length == 2
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })(myArray)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --after-user-code--
-
+```js
+(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);
+```
+
+## --seed-contents--
```js
// Setup
var myArray = [["John", 23], ["cat", 2]];
// Only change code below this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [["John", 23], ["cat", 2]];
myArray.push(["dog",3]);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md
index 79da8a6a32..ffeb4432a0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cRbVETW'
forumTopicId: 18238
---
-## Description
-
-pop() always removes the last element of an array. What if you want to remove the first?
-That's where .shift() comes in. It works just like .pop(), except it removes the first element instead of the last.
+# --description--
+
+`pop()` always removes the last element of an array. What if you want to remove the first?
+
+That's where `.shift()` comes in. It works just like `.pop()`, except it removes the first element instead of the last.
Example:
@@ -19,31 +20,53 @@ var removedFromOurArray = ourArray.shift();
// removedFromOurArray now equals "Stimpson" and ourArray now equals ["J", ["cat"]].
```
-
+# --instructions--
-## Instructions
-
-Use the .shift() function to remove the first item from myArray, assigning the "shifted off" value to removedFromMyArray.
-
+Use the `.shift()` function to remove the first item from `myArray`, assigning the "shifted off" value to `removedFromMyArray`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: myArray should now equal [["dog", 3]].
- testString: assert((function(d){if(d[0][0] == 'dog' && d[0][1] === 3 && d[1] == undefined){return true;}else{return false;}})(myArray));
- - text: removedFromMyArray should contain ["John", 23].
- testString: assert((function(d){if(d[0] == 'John' && d[1] === 23 && typeof removedFromMyArray === 'object'){return true;}else{return false;}})(removedFromMyArray));
+`myArray` should now equal `[["dog", 3]]`.
+```js
+assert(
+ (function (d) {
+ if (d[0][0] == 'dog' && d[0][1] === 3 && d[1] == undefined) {
+ return true;
+ } else {
+ return false;
+ }
+ })(myArray)
+);
```
-
+`removedFromMyArray` should contain `["John", 23]`.
-## Challenge Seed
-
+```js
+assert(
+ (function (d) {
+ if (
+ d[0] == 'John' &&
+ d[1] === 23 &&
+ typeof removedFromMyArray === 'object'
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })(removedFromMyArray)
+);
+```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [["John", 23], ["dog", 3]];
@@ -79,5 +84,3 @@ var myArray = [["John", 23], ["dog", 3]];
// Only change code below this line
var removedFromMyArray = myArray.shift();
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md
index 22f2ebff65..882984bcb1 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/ckNDESv'
forumTopicId: 18239
---
-## Description
-
-Not only can you shift elements off of the beginning of an array, you can also unshift elements to the beginning of an array i.e. add elements in front of the array.
-.unshift() works exactly like .push(), but instead of adding the element at the end of the array, unshift() adds the element at the beginning of the array.
+# --description--
+
+Not only can you `shift` elements off of the beginning of an array, you can also `unshift` elements to the beginning of an array i.e. add elements in front of the array.
+
+`.unshift()` works exactly like `.push()`, but instead of adding the element at the end of the array, `unshift()` adds the element at the beginning of the array.
Example:
@@ -20,29 +21,43 @@ ourArray.unshift("Happy");
// ourArray now equals ["Happy", "J", "cat"]
```
-
+# --instructions--
-## Instructions
-
-Add ["Paul",35] to the beginning of the myArray variable using unshift().
-
+Add `["Paul",35]` to the beginning of the `myArray` variable using `unshift()`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: myArray should now have [["Paul", 35], ["dog", 3]].
- testString: assert((function(d){if(typeof d[0] === "object" && d[0][0] == 'Paul' && d[0][1] === 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray));
+`myArray` should now have \[["Paul", 35], ["dog", 3]].
+```js
+assert(
+ (function (d) {
+ if (
+ typeof d[0] === 'object' &&
+ d[0][0] == 'Paul' &&
+ d[0][1] === 35 &&
+ d[1][0] != undefined &&
+ d[1][0] == 'dog' &&
+ d[1][1] != undefined &&
+ d[1][1] == 3
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })(myArray)
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --after-user-code--
-
+```js
+(function(y, z){return 'myArray = ' + JSON.stringify(y);})(myArray);
+```
+
+## --seed-contents--
```js
// Setup
@@ -50,32 +65,12 @@ var myArray = [["John", 23], ["dog", 3]];
myArray.shift();
// Only change code below this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [["John", 23], ["dog", 3]];
myArray.shift();
myArray.unshift(["Paul", 35]);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md
index b55a3f3530..1564e2ed69 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/c9yNMfR'
forumTopicId: 18208
---
-## Description
-
+# --description--
+
Sometimes you may want to store data in a flexible Data Structure. A JavaScript object is one way to handle flexible data. They allow for arbitrary combinations of strings, numbers, booleans, arrays, functions, and objects.
+
Here's an example of a complex data structure:
```js
@@ -27,9 +28,7 @@ var ourMusic = [
];
```
-This is an array which contains one object inside. The object has various pieces of metadata about an album. It also has a nested "formats" array. If you want to add more album records, you can do this by adding records to the top level array.
-Objects hold data in a property, which has a key-value format. In the example above, "artist": "Daft Punk" is a property that has a key of "artist" and a value of "Daft Punk".
-JavaScript Object Notation or JSON is a related data interchange format used to store data.
+This is an array which contains one object inside. The object has various pieces of metadata about an album. It also has a nested `"formats"` array. If you want to add more album records, you can do this by adding records to the top level array. Objects hold data in a property, which has a key-value format. In the example above, `"artist": "Daft Punk"` is a property that has a key of `"artist"` and a value of `"Daft Punk"`. [JavaScript Object Notation](http://www.json.org/) or `JSON` is a related data interchange format used to store data.
```json
{
@@ -45,46 +44,91 @@ Objects hold data in a property, which has a key-value format. In the example ab
}
```
-Note You will need to place a comma after every object in the array, unless it is the last object in the array.
-
+**Note**
+You will need to place a comma after every object in the array, unless it is the last object in the array.
-## Instructions
-
-Add a new album to the myMusic array. Add artist and title strings, release_year number, and a formats array of strings.
-
+# --instructions--
-## Tests
-
+Add a new album to the `myMusic` array. Add `artist` and `title` strings, `release_year` number, and a `formats` array of strings.
-```yml
-tests:
- - text: myMusic should be an array
- testString: assert(Array.isArray(myMusic));
- - text: myMusic should have at least two elements
- testString: assert(myMusic.length > 1);
- - text: myMusic[1] should be an object
- testString: assert(typeof myMusic[1] === 'object');
- - text: myMusic[1] should have at least 4 properties
- testString: assert(Object.keys(myMusic[1]).length > 3);
- - text: myMusic[1] should contain an artist property which is a string
- testString: assert(myMusic[1].hasOwnProperty('artist') && typeof myMusic[1].artist === 'string');
- - text: myMusic[1] should contain a title property which is a string
- testString: assert(myMusic[1].hasOwnProperty('title') && typeof myMusic[1].title === 'string');
- - text: myMusic[1] should contain a release_year property which is a number
- testString: assert(myMusic[1].hasOwnProperty('release_year') && typeof myMusic[1].release_year === 'number');
- - text: myMusic[1] should contain a formats property which is an array
- testString: assert(myMusic[1].hasOwnProperty('formats') && Array.isArray(myMusic[1].formats));
- - text: formats should be an array of strings with at least two elements
- testString: assert(myMusic[1].formats.every(function(item) { return (typeof item === "string")}) && myMusic[1].formats.length > 1);
+# --hints--
+`myMusic` should be an array
+
+```js
+assert(Array.isArray(myMusic));
```
-
+`myMusic` should have at least two elements
-## Challenge Seed
-
+```js
+assert(myMusic.length > 1);
+```
-
+`myMusic[1]` should be an object
+
+```js
+assert(typeof myMusic[1] === 'object');
+```
+
+`myMusic[1]` should have at least 4 properties
+
+```js
+assert(Object.keys(myMusic[1]).length > 3);
+```
+
+`myMusic[1]` should contain an `artist` property which is a string
+
+```js
+assert(
+ myMusic[1].hasOwnProperty('artist') && typeof myMusic[1].artist === 'string'
+);
+```
+
+`myMusic[1]` should contain a `title` property which is a string
+
+```js
+assert(
+ myMusic[1].hasOwnProperty('title') && typeof myMusic[1].title === 'string'
+);
+```
+
+`myMusic[1]` should contain a `release_year` property which is a number
+
+```js
+assert(
+ myMusic[1].hasOwnProperty('release_year') &&
+ typeof myMusic[1].release_year === 'number'
+);
+```
+
+`myMusic[1]` should contain a `formats` property which is an array
+
+```js
+assert(
+ myMusic[1].hasOwnProperty('formats') && Array.isArray(myMusic[1].formats)
+);
+```
+
+`formats` should be an array of strings with at least two elements
+
+```js
+assert(
+ myMusic[1].formats.every(function (item) {
+ return typeof item === 'string';
+ }) && myMusic[1].formats.length > 1
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(x){ if (Array.isArray(x)) { return JSON.stringify(x); } return "myMusic is not an array"})(myMusic);
+```
+
+## --seed-contents--
```js
var myMusic = [
@@ -101,26 +145,9 @@ var myMusic = [
}
// Add a record here
];
-
```
-
-
-
-### After Test
-
-
-```js
-(function(x){ if (Array.isArray(x)) { return JSON.stringify(x); } return "myMusic is not an array"})(myMusic);
-```
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myMusic = [
@@ -147,5 +174,3 @@ var myMusic = [
}
];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md
index f29fe291ce..a796be980d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md
@@ -6,73 +6,79 @@ videoUrl: 'https://scrimba.com/c/czQM4A8'
forumTopicId: 18241
---
-## Description
-
+# --description--
+
Unlike strings, the entries of arrays are mutable and can be changed freely.
-Example
+
+**Example**
```js
var ourArray = [50,40,30];
ourArray[0] = 15; // equals [15,40,30]
```
-Note There shouldn't be any spaces between the array name and the square brackets, like array [0]. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
-
+**Note**
+There shouldn't be any spaces between the array name and the square brackets, like `array [0]`. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
-## Instructions
-
-Modify the data stored at index 0 of myArray to a value of 45.
-
+# --instructions--
-## Tests
-
+Modify the data stored at index `0` of `myArray` to a value of `45`.
-```yml
-tests:
- - text: myArray should now be [45,64,99].
- testString: assert((function(){if(typeof myArray != 'undefined' && myArray[0] == 45 && myArray[1] == 64 && myArray[2] == 99){return true;}else{return false;}})());
- - text: You should be using correct index to modify the value in myArray.
- testString: assert((function(){if(code.match(/myArray\[0\]\s*=\s*/g)){return true;}else{return false;}})());
+# --hints--
+`myArray` should now be [45,64,99].
+
+```js
+assert(
+ (function () {
+ if (
+ typeof myArray != 'undefined' &&
+ myArray[0] == 45 &&
+ myArray[1] == 64 &&
+ myArray[2] == 99
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ })()
+);
```
-
+You should be using correct index to modify the value in `myArray`.
-## Challenge Seed
-
+```js
+assert(
+ (function () {
+ if (code.match(/myArray\[0\]\s*=\s*/g)) {
+ return true;
+ } else {
+ return false;
+ }
+ })()
+);
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+if(typeof myArray !== "undefined"){(function(){return myArray;})();}
+```
+
+## --seed-contents--
```js
// Setup
var myArray = [18,64,99];
// Only change code below this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myArray = [18,64,99];
myArray[0] = 45;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md
index 5327d58677..a44b3c0d37 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/cdBKWCV'
forumTopicId: 18242
---
-## Description
-
-If the break statement is omitted from a switch statement's case, the following case statement(s) are executed until a break is encountered. If you have multiple inputs with the same output, you can represent them in a switch statement like this:
+# --description--
+
+If the `break` statement is omitted from a `switch` statement's `case`, the following `case` statement(s) are executed until a `break` is encountered. If you have multiple inputs with the same output, you can represent them in a `switch` statement like this:
```js
var result = "";
@@ -24,50 +24,88 @@ switch(val) {
```
Cases for 1, 2, and 3 will all produce the same result.
-
-## Instructions
-
-Write a switch statement to set answer for the following ranges: 1-3 - "Low" 4-6 - "Mid" 7-9 - "High"
-Note You will need to have a case statement for each number in the range.
-
+# --instructions--
-## Tests
-
+Write a switch statement to set `answer` for the following ranges:
+`1-3` - "Low"
+`4-6` - "Mid"
+`7-9` - "High"
-```yml
-tests:
- - text: sequentialSizes(1) should return "Low"
- testString: assert(sequentialSizes(1) === "Low");
- - text: sequentialSizes(2) should return "Low"
- testString: assert(sequentialSizes(2) === "Low");
- - text: sequentialSizes(3) should return "Low"
- testString: assert(sequentialSizes(3) === "Low");
- - text: sequentialSizes(4) should return "Mid"
- testString: assert(sequentialSizes(4) === "Mid");
- - text: sequentialSizes(5) should return "Mid"
- testString: assert(sequentialSizes(5) === "Mid");
- - text: sequentialSizes(6) should return "Mid"
- testString: assert(sequentialSizes(6) === "Mid");
- - text: sequentialSizes(7) should return "High"
- testString: assert(sequentialSizes(7) === "High");
- - text: sequentialSizes(8) should return "High"
- testString: assert(sequentialSizes(8) === "High");
- - text: sequentialSizes(9) should return "High"
- testString: assert(sequentialSizes(9) === "High");
- - text: You should not use any if or else statements
- testString: assert(!/else/g.test(code) || !/if/g.test(code));
- - text: You should have nine case statements
- testString: assert(code.match(/case/g).length === 9);
+**Note**
+You will need to have a `case` statement for each number in the range.
+# --hints--
+
+`sequentialSizes(1)` should return "Low"
+
+```js
+assert(sequentialSizes(1) === 'Low');
```
-
+`sequentialSizes(2)` should return "Low"
-## Challenge Seed
-
+```js
+assert(sequentialSizes(2) === 'Low');
+```
-
+`sequentialSizes(3)` should return "Low"
+
+```js
+assert(sequentialSizes(3) === 'Low');
+```
+
+`sequentialSizes(4)` should return "Mid"
+
+```js
+assert(sequentialSizes(4) === 'Mid');
+```
+
+`sequentialSizes(5)` should return "Mid"
+
+```js
+assert(sequentialSizes(5) === 'Mid');
+```
+
+`sequentialSizes(6)` should return "Mid"
+
+```js
+assert(sequentialSizes(6) === 'Mid');
+```
+
+`sequentialSizes(7)` should return "High"
+
+```js
+assert(sequentialSizes(7) === 'High');
+```
+
+`sequentialSizes(8)` should return "High"
+
+```js
+assert(sequentialSizes(8) === 'High');
+```
+
+`sequentialSizes(9)` should return "High"
+
+```js
+assert(sequentialSizes(9) === 'High');
+```
+
+You should not use any `if` or `else` statements
+
+```js
+assert(!/else/g.test(code) || !/if/g.test(code));
+```
+
+You should have nine `case` statements
+
+```js
+assert(code.match(/case/g).length === 9);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function sequentialSizes(val) {
@@ -81,18 +119,9 @@ function sequentialSizes(val) {
}
sequentialSizes(1);
-
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function sequentialSizes(val) {
@@ -118,5 +147,3 @@ function sequentialSizes(val) {
return answer;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md
index 745681a508..b5cbaf3f1d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md
@@ -6,62 +6,46 @@ videoUrl: 'https://scrimba.com/c/ce2GeHq'
forumTopicId: 301173
---
-## Description
-
+# --description--
+
In JavaScript, you can also perform calculations with decimal numbers, just like whole numbers.
+
Let's multiply two decimals together to get their product.
-
-## Instructions
-
-Change the 0.0 so that product will equal 5.0.
-
+# --instructions--
-## Tests
-
+Change the `0.0` so that product will equal `5.0`.
-```yml
-tests:
- - text: The variable product should equal 5.0.
- testString: assert(product === 5.0);
- - text: You should use the * operator
- testString: assert(/\*/.test(code));
+# --hints--
-```
-
-
-
-## Challenge Seed
-
-
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var product = 2.0 * 0.0;
+```
+# --solutions--
```js
var product = 2.0 * 2.5;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md
index a0150f16ee..dc57cfb02d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md
@@ -6,70 +6,52 @@ videoUrl: 'https://scrimba.com/c/cP3y3Aq'
forumTopicId: 18243
---
-## Description
-
-We can also multiply one number by another.
-JavaScript uses the * symbol for multiplication of two numbers.
+# --description--
-Example
+We can also multiply one number by another.
+
+JavaScript uses the `*` symbol for multiplication of two numbers.
+
+**Example**
```js
myVar = 13 * 13; // assigned 169
```
+# --instructions--
-
+Change the `0` so that product will equal `80`.
-## Instructions
-
-Change the 0 so that product will equal 80.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: The variable product should be equal to 80.
- testString: assert(product === 80);
- - text: You should use the * operator.
- testString: assert(/\*/.test(code));
-
-```
-
-
-
-## Challenge Seed
-
-
-
+The variable `product` should be equal to 80.
```js
-var product = 8 * 0;
-
-
+assert(product === 80);
```
-
+You should use the `*` operator.
+```js
+assert(/\*/.test(code));
+```
-### After Test
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var product = 8 * 0;
+```
+# --solutions--
```js
var product = 8 * 10;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md
index 241ccaf773..e7ab17ba44 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.md
@@ -6,65 +6,45 @@ videoUrl: 'https://scrimba.com/c/crZQZf8'
forumTopicId: 18247
---
-## Description
-
+# --description--
+
You can also nest arrays within other arrays, like below:
```js
[["Bulls", 23], ["White Sox", 45]]
```
-This is also called a multi-dimensional array.
-
+This is also called a multi-dimensional array.
-## Instructions
-
-Create a nested array called myArray.
-
+# --instructions--
-## Tests
-
+Create a nested array called `myArray`.
-```yml
-tests:
- - text: myArray should have at least one array nested within another array.
- testString: assert(Array.isArray(myArray) && myArray.some(Array.isArray));
+# --hints--
-```
-
-
-
-## Challenge Seed
-
-
-
+`myArray` should have at least one array nested within another array.
```js
-// Only change code below this line
-var myArray = [];
-
+assert(Array.isArray(myArray) && myArray.some(Array.isArray));
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+// Only change code below this line
+var myArray = [];
+```
+# --solutions--
```js
var myArray = [[1,2,3]];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md
index db32805509..d1ec4cec8f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.md
@@ -6,8 +6,8 @@ videoUrl: 'https://scrimba.com/c/cRn6GHM'
forumTopicId: 18248
---
-## Description
-
+# --description--
+
If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example:
```js
@@ -21,34 +21,47 @@ for (var i=0; i < arr.length; i++) {
}
```
-This outputs each sub-element in arr one at a time. Note that for the inner loop, we are checking the .length of arr[i], since arr[i] is itself an array.
-
+This outputs each sub-element in `arr` one at a time. Note that for the inner loop, we are checking the `.length` of `arr[i]`, since `arr[i]` is itself an array.
-## Instructions
-
-Modify function multiplyAll so that it returns the product of all the numbers in the sub-arrays of arr.
-
+# --instructions--
-## Tests
-
+Modify function `multiplyAll` so that it returns the product of all the numbers in the sub-arrays of `arr`.
-```yml
-tests:
- - text: multiplyAll([[1],[2],[3]]) should return 6
- testString: assert(multiplyAll([[1],[2],[3]]) === 6);
- - text: multiplyAll([[1,2],[3,4],[5,6,7]]) should return 5040
- testString: assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040);
- - text: multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) should return 54
- testString: assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54);
+# --hints--
+`multiplyAll([[1],[2],[3]])` should return `6`
+
+```js
+assert(multiplyAll([[1], [2], [3]]) === 6);
```
-
+`multiplyAll([[1,2],[3,4],[5,6,7]])` should return `5040`
-## Challenge Seed
-
+```js
+assert(
+ multiplyAll([
+ [1, 2],
+ [3, 4],
+ [5, 6, 7]
+ ]) === 5040
+);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function multiplyAll(arr) {
@@ -86,5 +90,3 @@ function multiplyAll(arr) {
multiplyAll([[1,2],[3,4],[5,6,7]]);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md
index c52e166e94..3afd077b84 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cy8rahW'
forumTopicId: 18254
---
-## Description
-
+# --description--
+
Parameters are variables that act as placeholders for the values that are to be input to a function when it is called. When a function is defined, it is typically defined along with one or more parameters. The actual values that are input (or "passed") into a function when it is called are known as arguments.
-Here is a function with two parameters, param1 and param2:
+
+Here is a function with two parameters, `param1` and `param2`:
```js
function testFun(param1, param2) {
@@ -17,48 +18,55 @@ function testFun(param1, param2) {
}
```
-Then we can call testFun:
-testFun("Hello", "World");
-We have passed two arguments, "Hello" and "World". Inside the function, param1 will equal "Hello" and param2 will equal "World". Note that you could call testFun again with different arguments and the parameters would take on the value of the new arguments.
-
+Then we can call `testFun`: `testFun("Hello", "World");` We have passed two arguments, `"Hello"` and `"World"`. Inside the function, `param1` will equal "Hello" and `param2` will equal "World". Note that you could call `testFun` again with different arguments and the parameters would take on the value of the new arguments.
+
+# --instructions--
-## Instructions
-
Create a function called functionWithArgs that accepts two arguments and outputs their sum to the dev console.
Call the function with two numbers as arguments.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: functionWithArgs should be a function.
- testString: assert(typeof functionWithArgs === 'function');
- - text: functionWithArgs(1,2) should output 3.
- testString: if(typeof functionWithArgs === "function") { capture(); functionWithArgs(1,2); uncapture(); } assert(logOutput == 3);
- - text: functionWithArgs(7,9) should output 16.
- testString: if(typeof functionWithArgs === "function") { capture(); functionWithArgs(7,9); uncapture(); } assert(logOutput == 16);
- - text: You should call functionWithArgs with two numbers after you define it.
- testString: assert(/functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test(code.replace(/\s/g, '')));
-```
-
-
-
-## Challenge Seed
-
-
-
+`functionWithArgs` should be a function.
```js
-
-
-
+assert(typeof functionWithArgs === 'function');
```
-
+`functionWithArgs(1,2)` should output `3`.
-### Before Test
-
+```js
+if (typeof functionWithArgs === 'function') {
+ capture();
+ functionWithArgs(1, 2);
+ uncapture();
+}
+assert(logOutput == 3);
+```
+
+`functionWithArgs(7,9)` should output `16`.
+
+```js
+if (typeof functionWithArgs === 'function') {
+ capture();
+ functionWithArgs(7, 9);
+ uncapture();
+}
+assert(logOutput == 16);
+```
+
+You should call `functionWithArgs` with two numbers after you define it.
+
+```js
+assert(
+ /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test(
+ code.replace(/\s/g, '')
+ )
+);
+```
+
+# --seed--
+
+## --before-user-code--
```js
var logOutput = "";
@@ -83,10 +91,7 @@ function uncapture() {
capture();
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+```
+# --solutions--
```js
function functionWithArgs(a, b) {
@@ -112,5 +116,3 @@ function functionWithArgs(a, b) {
}
functionWithArgs(10, 5);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md
index 3e5be2411f..3047058c6e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md
@@ -6,51 +6,54 @@ videoUrl: 'https://scrimba.com/c/cm8PqCa'
forumTopicId: 301174
---
-## Description
-
-In the last two challenges, we learned about the equality operator (==) and the strict equality operator (===). Let's do a quick review and practice using these operators some more.
+# --description--
+
+In the last two challenges, we learned about the equality operator (`==`) and the strict equality operator (`===`). Let's do a quick review and practice using these operators some more.
+
If the values being compared are not of the same type, the equality operator will perform a type conversion, and then evaluate the values. However, the strict equality operator will compare both the data type and value as-is, without converting one type to the other.
-Examples
+
+**Examples**
```js
3 == '3' // returns true because JavaScript performs type conversion from string to number
3 === '3' // returns false because the types are different and type conversion is not performed
```
-Note In JavaScript, you can determine the type of a variable or a value with the typeof operator, as follows:
+**Note**
+In JavaScript, you can determine the type of a variable or a value with the `typeof` operator, as follows:
```js
typeof 3 // returns 'number'
typeof '3' // returns 'string'
```
-
+# --instructions--
-## Instructions
-
-The compareEquality function in the editor compares two values using the equality operator. Modify the function so that it returns "Equal" only when the values are strictly equal.
-
+The `compareEquality` function in the editor compares two values using the equality operator. Modify the function so that it returns "Equal" only when the values are strictly equal.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: compareEquality(10, "10") should return "Not Equal"
- testString: assert(compareEquality(10, "10") === "Not Equal");
- - text: compareEquality("20", 20) should return "Not Equal"
- testString: assert(compareEquality("20", 20) === "Not Equal");
- - text: You should use the === operator
- testString: assert(code.match(/===/g));
+`compareEquality(10, "10")` should return "Not Equal"
+```js
+assert(compareEquality(10, '10') === 'Not Equal');
```
-
+`compareEquality("20", 20)` should return "Not Equal"
-## Challenge Seed
-
+```js
+assert(compareEquality('20', 20) === 'Not Equal');
+```
-
+You should use the `===` operator
+
+```js
+assert(code.match(/===/g));
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -64,15 +67,7 @@ function compareEquality(a, b) {
compareEquality(10, "10");
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function compareEquality(a,b) {
@@ -82,5 +77,3 @@ function compareEquality(a,b) {
return "Not Equal";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md
index 099bf75fb9..51b1ef4b61 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.md
@@ -6,47 +6,64 @@ videoUrl: 'https://scrimba.com/c/cDqW2Cg'
forumTopicId: 18259
---
-## Description
-
+# --description--
+
We have an array of objects representing different people in our contacts lists.
-A lookUpProfile function that takes name and a property (prop) as arguments has been pre-written for you.
-The function should check if name is an actual contact's firstName and the given property (prop) is a property of that contact.
+
+A `lookUpProfile` function that takes `name` and a property (`prop`) as arguments has been pre-written for you.
+
+The function should check if `name` is an actual contact's `firstName` and the given property (`prop`) is a property of that contact.
+
If both are true, then return the "value" of that property.
-If name does not correspond to any contacts then return "No such contact".
-If prop does not correspond to any valid properties of a contact found to match name then return "No such property".
-
-## Instructions
-
+If `name` does not correspond to any contacts then return `"No such contact"`.
-
+If `prop` does not correspond to any valid properties of a contact found to match `name` then return `"No such property"`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: lookUpProfile("Kristian", "lastName") should return "Vos"
- testString: assert(lookUpProfile('Kristian','lastName') === "Vos");
- - text: lookUpProfile("Sherlock", "likes") should return ["Intriguing Cases", "Violin"]
- testString: assert.deepEqual(lookUpProfile("Sherlock", "likes"), ["Intriguing Cases", "Violin"]);
- - text: lookUpProfile("Harry", "likes") should return an array
- testString: assert(typeof lookUpProfile("Harry", "likes") === "object");
- - text: lookUpProfile("Bob", "number") should return "No such contact"
- testString: assert(lookUpProfile("Bob", "number") === "No such contact");
- - text: lookUpProfile("Bob", "potato") should return "No such contact"
- testString: assert(lookUpProfile("Bob", "potato") === "No such contact");
- - text: lookUpProfile("Akira", "address") should return "No such property"
- testString: assert(lookUpProfile("Akira", "address") === "No such property");
+`lookUpProfile("Kristian", "lastName")` should return `"Vos"`
+```js
+assert(lookUpProfile('Kristian', 'lastName') === 'Vos');
```
-
+`lookUpProfile("Sherlock", "likes")` should return `["Intriguing Cases", "Violin"]`
-## Challenge Seed
-
+```js
+assert.deepEqual(lookUpProfile('Sherlock', 'likes'), [
+ 'Intriguing Cases',
+ 'Violin'
+]);
+```
-
+`lookUpProfile("Harry", "likes")` should return an array
+
+```js
+assert(typeof lookUpProfile('Harry', 'likes') === 'object');
+```
+
+`lookUpProfile("Bob", "number")` should return "No such contact"
+
+```js
+assert(lookUpProfile('Bob', 'number') === 'No such contact');
+```
+
+`lookUpProfile("Bob", "potato")` should return "No such contact"
+
+```js
+assert(lookUpProfile('Bob', 'potato') === 'No such contact');
+```
+
+`lookUpProfile("Akira", "address")` should return "No such property"
+
+```js
+assert(lookUpProfile('Akira', 'address') === 'No such property');
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -87,15 +104,7 @@ function lookUpProfile(name, prop){
lookUpProfile("Akira", "likes");
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var contacts = [
@@ -139,5 +148,3 @@ function lookUpProfile(name, prop){
lookUpProfile("Akira", "likes");
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md
index b10c06f1f2..ce96f61269 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md
@@ -6,8 +6,8 @@ videoUrl: 'https://scrimba.com/c/cbQmnhM'
forumTopicId: 18260
---
-## Description
-
+# --description--
+
String values in JavaScript may be written with single or double quotes, as long as you start and end with the same type of quote. Unlike some other programming languages, single and double quotes work the same in JavaScript.
```js
@@ -15,7 +15,7 @@ doubleQuoteStr = "This is a string";
singleQuoteStr = 'This is also a string';
```
-The reason why you might want to use one type of quote over the other is if you want to use both in a string. This might happen if you want to save a conversation in a string and have the conversation in quotes. Another use for it would be saving an <a> tag with various attributes in quotes, all within a string.
+The reason why you might want to use one type of quote over the other is if you want to use both in a string. This might happen if you want to save a conversation in a string and have the conversation in quotes. Another use for it would be saving an `` tag with various attributes in quotes, all within a string.
```js
conversation = 'Finn exclaims to Jake, "Algebraic!"';
@@ -28,61 +28,50 @@ goodStr = 'Jake asks Finn, "Hey, let\'s go on an adventure?"';
badStr = 'Finn responds, "Let's go!"'; // Throws an error
```
-In the goodStr above, you can use both quotes safely by using the backslash \ as an escape character.
-Note The backslash \ should not be confused with the forward slash /. They do not do the same thing.
-
+In the goodStr above, you can use both quotes safely by using the backslash `\` as an escape character. **Note**
+The backslash `\` should not be confused with the forward slash `/`. They do not do the same thing.
+
+# --instructions--
-## Instructions
-
Change the provided string to a string with single quotes at the beginning and end and no escape characters.
-Right now, the <a> tag in the string uses double quotes everywhere. You will need to change the outer quotes to single quotes so you can remove the escape characters.
-
-## Tests
-
+Right now, the `` tag in the string uses double quotes everywhere. You will need to change the outer quotes to single quotes so you can remove the escape characters.
-```yml
-tests:
- - text: You should remove all the backslashes (\).
- testString: assert(!/\\/g.test(code) && myStr.match('\\s*\\s*Link\\s*\\s*'));
- - text: You should have two single quotes ' and four double quotes ".
- testString: assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2);
+# --hints--
-```
-
-
-
-## Challenge Seed
-
-
-
+You should remove all the `backslashes` (`\`).
```js
-var myStr = "Link";
-
-
+assert(
+ !/\\/g.test(code) &&
+ myStr.match(
+ '\\s*\\s*Link\\s*\\s*'
+ )
+);
```
-
+You should have two single quotes `'` and four double quotes `"`.
+```js
+assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2);
+```
-### After Test
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var myStr = "Link";
+```
+# --solutions--
```js
var myStr = 'Link';
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md
index 4ab8f46d43..e0d103b8b6 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md
@@ -5,57 +5,112 @@ challengeType: 1
forumTopicId: 18261
---
-## Description
-
-
+# --description--
You are given a JSON object representing a part of your musical album collection. Each album has a unique id number as its key and several other properties. Not all albums have complete information.
You start with an `updateRecords` function that takes an object like `collection`, an `id`, a `prop` (like `artist` or `tracks`), and a `value`. Complete the function using the rules below to modify the object passed to the function.
-- Your function must always return the entire object.
-- If `prop` isn't `tracks` and `value` isn't an empty string, update or set that album's `prop` to `value`.
-- If `prop` is `tracks` but the album doesn't have a `tracks` property, create an empty array and add `value` to it.
-- If `prop` is `tracks` and `value` isn't an empty string, add `value` to the end of the album's existing `tracks` array.
-- If `value` is an empty string, delete the given `prop` property from the album.
+- Your function must always return the entire object.
+- If `prop` isn't `tracks` and `value` isn't an empty string, update or set that album's `prop` to `value`.
+- If `prop` is `tracks` but the album doesn't have a `tracks` property, create an empty array and add `value` to it.
+- If `prop` is `tracks` and `value` isn't an empty string, add `value` to the end of the album's existing `tracks` array.
+- If `value` is an empty string, delete the given `prop` property from the album.
**Note:** A copy of the `collection` object is used for the tests.
-
-## Instructions
+# --hints--
-
+After `updateRecords(collection, 5439, "artist", "ABBA")`, `artist` should be `ABBA`
-
-
-## Tests
-
-
-
-```yml
-tests:
- - text: After updateRecords(collection, 5439, "artist", "ABBA"), artist should be ABBA
- testString: assert(updateRecords(_recordCollection, 5439, "artist", "ABBA")[5439]["artist"] === "ABBA");
- - text: After updateRecords(collection, 5439, "tracks", "Take a Chance on Me"), tracks should have Take a Chance on Me as the last element.
- testString: assert(updateRecords(_recordCollection, 5439, "tracks", "Take a Chance on Me")[5439]["tracks"].pop() === "Take a Chance on Me");
- - text: After updateRecords(collection, 2548, "artist", ""), artist should not be set
- testString: updateRecords(_recordCollection, 2548, "artist", ""); assert(!_recordCollection[2548].hasOwnProperty("artist"));
- - text: After updateRecords(collection, 1245, "tracks", "Addicted to Love"), tracks should have Addicted to Love as the last element.
- testString: assert(updateRecords(_recordCollection, 1245, "tracks", "Addicted to Love")[1245]["tracks"].pop() === "Addicted to Love");
- - text: After updateRecords(collection, 2468, "tracks", "Free"), tracks should have 1999 as the first element.
- testString: assert(updateRecords(_recordCollection, 2468, "tracks", "Free")[2468]["tracks"][0] === "1999");
- - text: After updateRecords(collection, 2548, "tracks", ""), tracks should not be set
- testString: updateRecords(_recordCollection, 2548, "tracks", ""); assert(!_recordCollection[2548].hasOwnProperty("tracks"));
- - text: After updateRecords(collection, 1245, "albumTitle", "Riptide"), albumTitle should be Riptide
- testString: assert(updateRecords(_recordCollection, 1245, "albumTitle", "Riptide")[1245]["albumTitle"] === "Riptide");
+```js
+assert(
+ updateRecords(_recordCollection, 5439, 'artist', 'ABBA')[5439]['artist'] ===
+ 'ABBA'
+);
```
-
+After `updateRecords(collection, 5439, "tracks", "Take a Chance on Me")`, `tracks` should have `Take a Chance on Me` as the last element.
-## Challenge Seed
+```js
+assert(
+ updateRecords(_recordCollection, 5439, 'tracks', 'Take a Chance on Me')[5439][
+ 'tracks'
+ ].pop() === 'Take a Chance on Me'
+);
+```
-
-
+After `updateRecords(collection, 2548, "artist", "")`, `artist` should not be set
+
+```js
+updateRecords(_recordCollection, 2548, 'artist', '');
+assert(!_recordCollection[2548].hasOwnProperty('artist'));
+```
+
+After `updateRecords(collection, 1245, "tracks", "Addicted to Love")`, `tracks` should have `Addicted to Love` as the last element.
+
+```js
+assert(
+ updateRecords(_recordCollection, 1245, 'tracks', 'Addicted to Love')[1245][
+ 'tracks'
+ ].pop() === 'Addicted to Love'
+);
+```
+
+After `updateRecords(collection, 2468, "tracks", "Free")`, `tracks` should have `1999` as the first element.
+
+```js
+assert(
+ updateRecords(_recordCollection, 2468, 'tracks', 'Free')[2468][
+ 'tracks'
+ ][0] === '1999'
+);
+```
+
+After `updateRecords(collection, 2548, "tracks", "")`, `tracks` should not be set
+
+```js
+updateRecords(_recordCollection, 2548, 'tracks', '');
+assert(!_recordCollection[2548].hasOwnProperty('tracks'));
+```
+
+After `updateRecords(collection, 1245, "albumTitle", "Riptide")`, `albumTitle` should be `Riptide`
+
+```js
+assert(
+ updateRecords(_recordCollection, 1245, 'albumTitle', 'Riptide')[1245][
+ 'albumTitle'
+ ] === 'Riptide'
+);
+```
+
+# --seed--
+
+## --before-user-code--
+
+```js
+const _recordCollection = {
+ 2548: {
+ albumTitle: 'Slippery When Wet',
+ artist: 'Bon Jovi',
+ tracks: ['Let It Rock', 'You Give Love a Bad Name']
+ },
+ 2468: {
+ albumTitle: '1999',
+ artist: 'Prince',
+ tracks: ['1999', 'Little Red Corvette']
+ },
+ 1245: {
+ artist: 'Robert Palmer',
+ tracks: []
+ },
+ 5439: {
+ albumTitle: 'ABBA Gold'
+ }
+};
+```
+
+## --seed-contents--
```js
// Setup
@@ -87,41 +142,7 @@ function updateRecords(object, id, prop, value) {
updateRecords(collection, 5439, 'artist', 'ABBA');
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var collection = {
@@ -157,5 +178,3 @@ function updateRecords(object, id, prop, value) {
return object;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md
index ac1953f4a1..8845bb2e22 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md
@@ -2,13 +2,14 @@
id: 5cfa3679138e7d9595b9d9d4
title: Replace Loops using Recursion
challengeType: 1
-videoUrl: 'https://www.freecodecamp.org/news/how-recursion-works-explained-with-flowcharts-and-a-video-de61f40cb7f9/'
+videoUrl: >-
+ https://www.freecodecamp.org/news/how-recursion-works-explained-with-flowcharts-and-a-video-de61f40cb7f9/
forumTopicId: 301175
---
-## Description
-
-Recursion is the concept that a function can be expressed in terms of itself. To help understand this, start by thinking about the following task: multiply the first n elements of an array to create the product of those elements. Using a for loop, you could do this:
+# --description--
+
+Recursion is the concept that a function can be expressed in terms of itself. To help understand this, start by thinking about the following task: multiply the first `n` elements of an array to create the product of those elements. Using a `for` loop, you could do this:
```js
function multiply(arr, n) {
@@ -20,7 +21,7 @@ Recursion is the concept that a function can be expressed in terms of itself. To
}
```
-However, notice that multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1]. That means you can rewrite multiply in terms of itself and never need to use a loop.
+However, notice that `multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1]`. That means you can rewrite `multiply` in terms of itself and never need to use a loop.
```js
function multiply(arr, n) {
@@ -32,42 +33,55 @@ However, notice that multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1]
}
```
-The recursive version of multiply breaks down like this. In the base case, where n <= 0, it returns 1. For larger values of n, it calls itself, but with n - 1. That function call is evaluated in the same way, calling multiply again until n <= 0. At this point, all the functions can return and the original multiply returns the answer.
+The recursive version of `multiply` breaks down like this. In the base case, where `n <= 0`, it returns 1. For larger values of `n`, it calls itself, but with `n - 1`. That function call is evaluated in the same way, calling `multiply` again until `n <= 0`. At this point, all the functions can return and the original `multiply` returns the answer.
-Note: Recursive functions must have a base case when they return without calling the function again (in this example, when n <= 0), otherwise they can never finish executing.
+**Note:** Recursive functions must have a base case when they return without calling the function again (in this example, when `n <= 0`), otherwise they can never finish executing.
-
+# --instructions--
-## Instructions
-
+Write a recursive function, `sum(arr, n)`, that returns the sum of the first `n` elements of an array `arr`.
-Write a recursive function, sum(arr, n), that returns the sum of the first n elements of an array arr.
+# --hints--
-
+`sum([1], 0)` should equal 0.
-## Tests
-
-
-``` yml
-tests:
- - text: sum([1], 0) should equal 0.
- testString: assert.equal(sum([1], 0), 0);
- - text: sum([2, 3, 4], 1) should equal 2.
- testString: assert.equal(sum([2, 3, 4], 1), 2);
- - text: sum([2, 3, 4, 5], 3) should equal 9.
- testString: assert.equal(sum([2, 3, 4, 5], 3), 9);
- - text: Your code should not rely on any kind of loops (for or while or higher order functions such as forEach, map, filter, or reduce.).
- testString: assert(!__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g));
- - text: You should use recursion to solve this problem.
- testString: assert(__helpers.removeJSComments(sum.toString()).match(/sum\(.*\)/g).length > 1);
+```js
+assert.equal(sum([1], 0), 0);
```
-
+`sum([2, 3, 4], 1)` should equal 2.
-## Challenge Seed
-
+```js
+assert.equal(sum([2, 3, 4], 1), 2);
+```
-
+`sum([2, 3, 4, 5], 3)` should equal 9.
+
+```js
+assert.equal(sum([2, 3, 4, 5], 3), 9);
+```
+
+Your code should not rely on any kind of loops (`for` or `while` or higher order functions such as `forEach`, `map`, `filter`, or `reduce`.).
+
+```js
+assert(
+ !__helpers
+ .removeJSComments(code)
+ .match(/for|while|forEach|map|filter|reduce/g)
+);
+```
+
+You should use recursion to solve this problem.
+
+```js
+assert(
+ __helpers.removeJSComments(sum.toString()).match(/sum\(.*\)/g).length > 1
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function sum(arr, n) {
@@ -75,15 +89,9 @@ function sum(arr, n) {
// Only change code above this line
}
-
```
-
-
-
-
-## Solution
-
+# --solutions--
```js
function sum(arr, n) {
@@ -95,7 +103,4 @@ function sum(arr, n) {
}
// Only change code above this line
}
-
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md
index 593174311d..e48842ed02 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md
@@ -6,9 +6,9 @@ videoUrl: 'https://scrimba.com/c/c3JE8fy'
forumTopicId: 18266
---
-## Description
-
-If you have many options to choose from, a switch statement can be easier to write than many chained if/else if statements. The following:
+# --description--
+
+If you have many options to choose from, a `switch` statement can be easier to write than many chained `if`/`else if` statements. The following:
```js
if (val === 1) {
@@ -35,47 +35,75 @@ switch(val) {
}
```
-
+# --instructions--
-## Instructions
-
-Change the chained if/else if statements into a switch statement.
-
+Change the chained `if`/`else if` statements into a `switch` statement.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should not use any else statements anywhere in the editor
- testString: assert(!/else/g.test(code));
- - text: You should not use any if statements anywhere in the editor
- testString: assert(!/if/g.test(code));
- - text: You should have at least four break statements
- testString: assert(code.match(/break/g).length >= 4);
- - text: chainToSwitch("bob") should be "Marley"
- testString: assert(chainToSwitch("bob") === "Marley");
- - text: chainToSwitch(42) should be "The Answer"
- testString: assert(chainToSwitch(42) === "The Answer");
- - text: "chainToSwitch(1) should be \"There is no #1\""
- testString: "assert(chainToSwitch(1) === \"There is no #1\");"
- - text: chainToSwitch(99) should be "Missed me by this much!"
- testString: assert(chainToSwitch(99) === "Missed me by this much!");
- - text: chainToSwitch(7) should be "Ate Nine"
- testString: assert(chainToSwitch(7) === "Ate Nine");
- - text: chainToSwitch("John") should be "" (empty string)
- testString: assert(chainToSwitch("John") === "");
- - text: chainToSwitch(156) should be "" (empty string)
- testString: assert(chainToSwitch(156) === "");
+You should not use any `else` statements anywhere in the editor
+```js
+assert(!/else/g.test(code));
```
-
+You should not use any `if` statements anywhere in the editor
-## Challenge Seed
-
+```js
+assert(!/if/g.test(code));
+```
-
+You should have at least four `break` statements
+
+```js
+assert(code.match(/break/g).length >= 4);
+```
+
+`chainToSwitch("bob")` should be "Marley"
+
+```js
+assert(chainToSwitch('bob') === 'Marley');
+```
+
+`chainToSwitch(42)` should be "The Answer"
+
+```js
+assert(chainToSwitch(42) === 'The Answer');
+```
+
+`chainToSwitch(1)` should be "There is no #1"
+
+```js
+assert(chainToSwitch(1) === 'There is no #1');
+```
+
+`chainToSwitch(99)` should be "Missed me by this much!"
+
+```js
+assert(chainToSwitch(99) === 'Missed me by this much!');
+```
+
+`chainToSwitch(7)` should be "Ate Nine"
+
+```js
+assert(chainToSwitch(7) === 'Ate Nine');
+```
+
+`chainToSwitch("John")` should be "" (empty string)
+
+```js
+assert(chainToSwitch('John') === '');
+```
+
+`chainToSwitch(156)` should be "" (empty string)
+
+```js
+assert(chainToSwitch(156) === '');
+```
+
+# --seed--
+
+## --seed-contents--
```js
function chainToSwitch(val) {
@@ -99,18 +127,9 @@ function chainToSwitch(val) {
}
chainToSwitch(7);
-
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function chainToSwitch(val) {
@@ -135,5 +154,3 @@ function chainToSwitch(val) {
return answer;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md
index 5bac9966f6..33fc2e2e21 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cy87wue'
forumTopicId: 18271
---
-## Description
-
-We can pass values into a function with arguments. You can use a return statement to send a value back out of a function.
-Example
+# --description--
+
+We can pass values into a function with arguments. You can use a `return` statement to send a value back out of a function.
+
+**Example**
```js
function plusThree(num) {
@@ -18,52 +19,46 @@ function plusThree(num) {
var answer = plusThree(5); // 8
```
-plusThree takes an argument for num and returns a value equal to num + 3.
-
+`plusThree` takes an argument for `num` and returns a value equal to `num + 3`.
-## Instructions
-
-Create a function timesFive that accepts one argument, multiplies it by 5, and returns the new value. See the last line in the editor for an example of how you can test your timesFive function.
-
+# --instructions--
-## Tests
-
+Create a function `timesFive` that accepts one argument, multiplies it by `5`, and returns the new value. See the last line in the editor for an example of how you can test your `timesFive` function.
-```yml
-tests:
- - text: timesFive should be a function
- testString: assert(typeof timesFive === 'function');
- - text: timesFive(5) should return 25
- testString: assert(timesFive(5) === 25);
- - text: timesFive(2) should return 10
- testString: assert(timesFive(2) === 10);
- - text: timesFive(0) should return 0
- testString: assert(timesFive(0) === 0);
+# --hints--
-```
-
-
-
-## Challenge Seed
-
-
-
+`timesFive` should be a function
```js
-
-
-
+assert(typeof timesFive === 'function');
```
-
+`timesFive(5)` should return `25`
+```js
+assert(timesFive(5) === 25);
+```
+`timesFive(2)` should return `10`
-
+```js
+assert(timesFive(2) === 10);
+```
-## Solution
-
+`timesFive(0)` should return `0`
+```js
+assert(timesFive(0) === 0);
+```
+
+# --seed--
+
+## --seed-contents--
+
+```js
+```
+
+# --solutions--
```js
function timesFive(num) {
@@ -71,5 +66,3 @@ function timesFive(num) {
}
timesFive(10);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md
index 3b78abc0c2..feca98c894 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cQe39Sq'
forumTopicId: 18272
---
-## Description
-
-When a return statement is reached, the execution of the current function stops and control returns to the calling location.
-Example
+# --description--
+
+When a `return` statement is reached, the execution of the current function stops and control returns to the calling location.
+
+**Example**
```js
function myFun() {
@@ -20,43 +21,62 @@ function myFun() {
myFun();
```
-The above outputs "Hello" to the console, returns "World", but "byebye" is never output, because the function exits at the return statement.
-
+The above outputs "Hello" to the console, returns "World", but `"byebye"` is never output, because the function exits at the `return` statement.
-## Instructions
-
-Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.
-Hint Remember that undefined is a keyword, not a string.
-
+# --instructions--
-## Tests
-
+Modify the function `abTest` so that if `a` or `b` are less than `0` the function will immediately exit with a value of `undefined`.
-```yml
-tests:
- - text: abTest(2,2) should return a number
- testString: assert(typeof abTest(2,2) === 'number' );
- - text: abTest(2,2) should return 8
- testString: assert(abTest(2,2) === 8 );
- - text: abTest(-2,2) should return undefined
- testString: assert(abTest(-2,2) === undefined );
- - text: abTest(2,-2) should return undefined
- testString: assert(abTest(2,-2) === undefined );
- - text: abTest(2,8) should return 18
- testString: assert(abTest(2,8) === 18 );
- - text: abTest(3,3) should return 12
- testString: assert(abTest(3,3) === 12 );
- - text: abTest(0,0) should return 0
- testString: assert(abTest(0,0) === 0);
-
+**Hint**
+Remember that [`undefined` is a keyword](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables), not a string.
+
+# --hints--
+
+`abTest(2,2)` should return a number
+
+```js
+assert(typeof abTest(2, 2) === 'number');
```
-
+`abTest(2,2)` should return `8`
-## Challenge Seed
-
+```js
+assert(abTest(2, 2) === 8);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function abTest(a, b) {
@@ -91,5 +103,3 @@ function abTest(a, b) {
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md
index 669f4b016d..d74b365e28 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cp62qAQ'
forumTopicId: 18273
---
-## Description
-
-You may recall from Comparison with the Equality Operator that all comparison operators return a boolean true or false value.
+# --description--
+
+You may recall from [Comparison with the Equality Operator](/learn/javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator) that all comparison operators return a boolean `true` or `false` value.
+
Sometimes people use an if/else statement to do a comparison, like this:
```js
@@ -21,7 +22,7 @@ function isEqual(a,b) {
}
```
-But there's a better way to do this. Since === returns true or false, we can return the result of the comparison:
+But there's a better way to do this. Since `===` returns `true` or `false`, we can return the result of the comparison:
```js
function isEqual(a,b) {
@@ -29,33 +30,33 @@ function isEqual(a,b) {
}
```
-
+# --instructions--
-## Instructions
-
-Fix the function isLess to remove the if/else statements.
-
+Fix the function `isLess` to remove the `if/else` statements.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: isLess(10,15) should return true
- testString: assert(isLess(10,15) === true);
- - text: isLess(15,10) should return false
- testString: assert(isLess(15, 10) === false);
- - text: You should not use any if or else statements
- testString: assert(!/if|else/g.test(code));
+`isLess(10,15)` should return `true`
+```js
+assert(isLess(10, 15) === true);
```
-
+`isLess(15,10)` should return `false`
-## Challenge Seed
-
+```js
+assert(isLess(15, 10) === false);
+```
-
+You should not use any `if` or `else` statements
+
+```js
+assert(!/if|else/g.test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```js
function isLess(a, b) {
@@ -71,20 +72,10 @@ function isLess(a, b) {
isLess(10, 15);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function isLess(a, b) {
return a < b;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md
index e34faced05..8c3e361898 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/c4mv4fm'
forumTopicId: 18277
---
-## Description
-
-If you have many options to choose from, use a switch statement. A switch statement tests a value and can have many case statements which define various possible values. Statements are executed from the first matched case value until a break is encountered.
-Here is an example of a switch statement:
+# --description--
+
+If you have many options to choose from, use a switch statement. A `switch` statement tests a value and can have many case statements which define various possible values. Statements are executed from the first matched `case` value until a `break` is encountered.
+
+Here is an example of a `switch` statement:
```js
switch(lowercaseLetter) {
@@ -22,40 +23,57 @@ switch(lowercaseLetter) {
}
```
-case values are tested with strict equality (===). The break tells JavaScript to stop executing statements. If the break is omitted, the next statement will be executed.
-
+`case` values are tested with strict equality (`===`). The `break` tells JavaScript to stop executing statements. If the `break` is omitted, the next statement will be executed.
-## Instructions
-
-Write a switch statement which tests val and sets answer for the following conditions: 1 - "alpha" 2 - "beta" 3 - "gamma" 4 - "delta"
-
+# --instructions--
-## Tests
-
+Write a switch statement which tests `val` and sets `answer` for the following conditions:
+`1` - "alpha"
+`2` - "beta"
+`3` - "gamma"
+`4` - "delta"
-```yml
-tests:
- - text: caseInSwitch(1) should have a value of "alpha"
- testString: assert(caseInSwitch(1) === "alpha");
- - text: caseInSwitch(2) should have a value of "beta"
- testString: assert(caseInSwitch(2) === "beta");
- - text: caseInSwitch(3) should have a value of "gamma"
- testString: assert(caseInSwitch(3) === "gamma");
- - text: caseInSwitch(4) should have a value of "delta"
- testString: assert(caseInSwitch(4) === "delta");
- - text: You should not use any if or else statements
- testString: assert(!/else/g.test(code) || !/if/g.test(code));
- - text: You should have at least 3 break statements
- testString: assert(code.match(/break/g).length > 2);
+# --hints--
+`caseInSwitch(1)` should have a value of "alpha"
+
+```js
+assert(caseInSwitch(1) === 'alpha');
```
-
+`caseInSwitch(2)` should have a value of "beta"
-## Challenge Seed
-
+```js
+assert(caseInSwitch(2) === 'beta');
+```
-
+`caseInSwitch(3)` should have a value of "gamma"
+
+```js
+assert(caseInSwitch(3) === 'gamma');
+```
+
+`caseInSwitch(4)` should have a value of "delta"
+
+```js
+assert(caseInSwitch(4) === 'delta');
+```
+
+You should not use any `if` or `else` statements
+
+```js
+assert(!/else/g.test(code) || !/if/g.test(code));
+```
+
+You should have at least 3 `break` statements
+
+```js
+assert(code.match(/break/g).length > 2);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function caseInSwitch(val) {
@@ -69,18 +87,9 @@ function caseInSwitch(val) {
}
caseInSwitch(1);
-
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function caseInSwitch(val) {
@@ -102,5 +111,3 @@ function caseInSwitch(val) {
return answer;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md
index e7287ab45b..c323b2d426 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.md
@@ -6,53 +6,45 @@ videoUrl: 'https://scrimba.com/c/c9MEKHZ'
forumTopicId: 18280
---
-## Description
-
-Create a shopping list in the variable myList. The list should be a multi-dimensional array containing several sub-arrays.
+# --description--
+
+Create a shopping list in the variable `myList`. The list should be a multi-dimensional array containing several sub-arrays.
+
The first element in each sub-array should contain a string with the name of the item. The second element should be a number representing the quantity i.e.
-["Chocolate Bar", 15]
+
+`["Chocolate Bar", 15]`
+
There should be at least 5 sub-arrays in the list.
-
-## Instructions
-
+# --hints--
-
-
-## Tests
-
-
-```yml
-tests:
- - text: myList should be an array.
- testString: assert(isArray);
- - text: The first elements in each of your sub-arrays should all be strings.
- testString: assert(hasString);
- - text: The second elements in each of your sub-arrays should all be numbers.
- testString: assert(hasNumber);
- - text: You should have at least 5 items in your list.
- testString: assert(count > 4);
-
-```
-
-
-
-## Challenge Seed
-
-
-
+`myList` should be an array.
```js
-var myList = [];
-
-
+assert(isArray);
```
-
+The first elements in each of your sub-arrays should all be strings.
+```js
+assert(hasString);
+```
-### After Test
-
+The second elements in each of your sub-arrays should all be numbers.
+
+```js
+assert(hasNumber);
+```
+
+You should have at least 5 items in your list.
+
+```js
+assert(count > 4);
+```
+
+# --seed--
+
+## --after-user-code--
```js
var count = 0;
@@ -83,13 +75,13 @@ var hasNumber = false;
})(myList);
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var myList = [];
+```
+# --solutions--
```js
var myList = [
@@ -100,5 +92,3 @@ var myList = [
["Toads", 9]
];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md
index 3985166c51..4106d41743 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.md
@@ -6,67 +6,52 @@ videoUrl: 'https://scrimba.com/c/ca8Q8tP'
forumTopicId: 18307
---
-## Description
-
+# --description--
+
In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.
-Write a function nextInLine which takes an array (arr) and a number (item) as arguments.
+
+Write a function `nextInLine` which takes an array (`arr`) and a number (`item`) as arguments.
+
Add the number to the end of the array, then remove the first element of the array.
-The nextInLine function should then return the element that was removed.
-
-## Instructions
-
+The `nextInLine` function should then return the element that was removed.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: nextInLine([], 5) should return a number.
- testString: assert.isNumber(nextInLine([],5));
- - text: nextInLine([], 1) should return 1
- testString: assert(nextInLine([],1) === 1);
- - text: nextInLine([2], 1) should return 2
- testString: assert(nextInLine([2],1) === 2);
- - text: nextInLine([5,6,7,8,9], 1) should return 5
- testString: assert(nextInLine([5,6,7,8,9],1) === 5);
- - text: After nextInLine(testArr, 10), testArr[4] should be 10
- testString: nextInLine(testArr, 10); assert(testArr[4] === 10);
-
-```
-
-
-
-## Challenge Seed
-
-
-
+`nextInLine([], 5)` should return a number.
```js
-function nextInLine(arr, item) {
- // Only change code below this line
-
- return item;
- // Only change code above this line
-
-
-}
-
-// Setup
-var testArr = [1,2,3,4,5];
-
-// Display code
-console.log("Before: " + JSON.stringify(testArr));
-console.log(nextInLine(testArr, 6));
-console.log("After: " + JSON.stringify(testArr));
+assert.isNumber(nextInLine([], 5));
```
-
+`nextInLine([], 1)` should return `1`
-### Before Test
-
+## --seed-contents--
-
+```js
+function nextInLine(arr, item) {
+ // Only change code below this line
+
+ return item;
+ // Only change code above this line
+
-## Solution
-
+}
+// Setup
+var testArr = [1,2,3,4,5];
+
+// Display code
+console.log("Before: " + JSON.stringify(testArr));
+console.log(nextInLine(testArr, 6));
+console.log("After: " + JSON.stringify(testArr));
+```
+
+# --solutions--
```js
var testArr = [ 1,2,3,4,5];
@@ -118,5 +115,3 @@ function nextInLine(arr, item) {
return arr.shift();
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md
index b875852fc6..4e163659b0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.md
@@ -6,66 +6,58 @@ videoUrl: 'https://scrimba.com/c/crZQWAm'
forumTopicId: 18309
---
-## Description
-
-With JavaScript array variables, we can store several pieces of data in one place.
+# --description--
+
+With JavaScript `array` variables, we can store several pieces of data in one place.
+
You start an array declaration with an opening square bracket, end it with a closing square bracket, and put a comma between each entry, like this:
-var sandwich = ["peanut butter", "jelly", "bread"].
-
-## Instructions
-
-Modify the new array myArray so that it contains both a string and a number (in that order).
-Hint Refer to the example code in the text editor if you get stuck.
-
+`var sandwich = ["peanut butter", "jelly", "bread"]`.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: myArray should be an array.
- testString: assert(typeof myArray == 'object');
- - text: The first item in myArray should be a string.
- testString: assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string');
- - text: The second item in myArray should be a number.
- testString: assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number');
+Modify the new array `myArray` so that it contains both a `string` and a `number` (in that order).
-```
+**Hint**
+Refer to the example code in the text editor if you get stuck.
-
+# --hints--
-## Challenge Seed
-
-
-
+`myArray` should be an `array`.
```js
-// Only change code below this line
-var myArray = [];
-
+assert(typeof myArray == 'object');
```
-
+The first item in `myArray` should be a `string`.
+```js
+assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string');
+```
-### After Test
-
+The second item in `myArray` should be a `number`.
+
+```js
+assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number');
+```
+
+# --seed--
+
+## --after-user-code--
```js
(function(z){return z;})(myArray);
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+// Only change code below this line
+var myArray = [];
+```
+# --solutions--
```js
var myArray = ["The Answer", 42];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md
index 7c31545956..479f9a1421 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md
@@ -6,57 +6,44 @@ videoUrl: 'https://scrimba.com/c/cEanysE'
forumTopicId: 18310
---
-## Description
-
-In JavaScript, you can store a value in a variable with the assignment operator (=).
-myVariable = 5;
-This assigns the Number value 5 to myVariable.
-If there are any calculations to the right of the = operator, those are performed before the value is assigned to the variable on the left of the operator.
+# --description--
+
+In JavaScript, you can store a value in a variable with the assignment operator (`=`).
+
+`myVariable = 5;`
+
+This assigns the `Number` value `5` to `myVariable`.
+
+If there are any calculations to the right of the `=` operator, those are performed before the value is assigned to the variable on the left of the operator.
```js
var myVar;
myVar = 5;
```
-First, this code creates a variable named myVar. Then, the code assigns 5 to myVar. Now, if myVar appears again in the code, the program will treat it as if it is 5.
-
+First, this code creates a variable named `myVar`. Then, the code assigns `5` to `myVar`. Now, if `myVar` appears again in the code, the program will treat it as if it is `5`.
-## Instructions
-
-Assign the value 7 to variable a.
-
+# --instructions--
-## Tests
-
+Assign the value `7` to variable `a`.
-```yml
-tests:
- - text: You should not change code above the specified comment.
- testString: assert(/var a;/.test(code));
- - text: a should have a value of 7.
- testString: assert(typeof a === 'number' && a === 7);
+# --hints--
-```
-
-
-
-## Challenge Seed
-
-
-
+You should not change code above the specified comment.
```js
-// Setup
-var a;
-
-// Only change code below this line
-
+assert(/var a;/.test(code));
```
-
+`a` should have a value of 7.
-### Before Test
-
+```js
+assert(typeof a === 'number' && a === 7);
+```
+
+# --seed--
+
+## --before-user-code--
```js
if (typeof a != 'undefined') {
@@ -64,26 +51,24 @@ if (typeof a != 'undefined') {
}
```
-
+## --seed-contents--
-
+```js
+// Setup
+var a;
-## Solution
-
+// Only change code below this line
+```
+# --solutions--
```js
var a;
a = 7;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md
index ee430d8bc5..14d130864d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md
@@ -6,69 +6,52 @@ videoUrl: 'https://scrimba.com/c/cP3yQtk'
forumTopicId: 18314
---
-## Description
-
-We can also subtract one number from another.
-JavaScript uses the - symbol for subtraction.
+# --description--
-Example
+We can also subtract one number from another.
+
+JavaScript uses the `-` symbol for subtraction.
+
+**Example**
```js
myVar = 12 - 6; // assigned 6
```
+# --instructions--
-
+Change the `0` so the difference is `12`.
-## Instructions
-
-Change the 0 so the difference is 12.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: The variable difference should be equal to 12.
- testString: assert(difference === 12);
- - text: You should only subtract one number from 45.
- testString: assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code)));
-```
-
-
-
-## Challenge Seed
-
-
-
+The variable `difference` should be equal to 12.
```js
-var difference = 45 - 0;
-
-
+assert(difference === 12);
```
-
+You should only subtract one number from 45.
+```js
+assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code)));
+```
-### After Test
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+var difference = 45 - 0;
+```
+# --solutions--
```js
var difference = 45 - 33;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index ac6a766013..25afe89ab7 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/c6Wz4ySr'
forumTopicId: 18324
---
-## Description
-
-Sometimes it is useful to check if the property of a given object exists or not. We can use the .hasOwnProperty(propname) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true or false if the property is found or not.
-Example
+# --description--
+
+Sometimes it is useful to check if the property of a given object exists or not. We can use the `.hasOwnProperty(propname)` method of objects to determine if that object has the given property name. `.hasOwnProperty()` returns `true` or `false` if the property is found or not.
+
+**Example**
```js
var myObj = {
@@ -20,38 +21,58 @@ myObj.hasOwnProperty("top"); // true
myObj.hasOwnProperty("middle"); // false
```
-
+# --instructions--
-## Instructions
-
-Modify the function checkObj to test if an object passed to the function (obj) contains a specific property (checkProp). If the property is found, return that property's value. If not, return "Not Found".
-
+Modify the function `checkObj` to test if an object passed to the function (`obj`) contains a specific property (`checkProp`). If the property is found, return that property's value. If not, return `"Not Found"`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: 'checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift") should return "pony".'
- testString: 'assert(checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift") === "pony");'
- - text: 'checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet") should return "kitten".'
- testString: 'assert(checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet") === "kitten");'
- - text: 'checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "house") should return "Not Found".'
- testString: 'assert(checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "house") === "Not Found");'
- - text: 'checkObj({city: "Seattle"}, "city") should return "Seattle".'
- testString: 'assert(checkObj({city: "Seattle"}, "city") === "Seattle");'
- - text: 'checkObj({city: "Seattle"}, "district") should return "Not Found".'
- testString: 'assert(checkObj({city: "Seattle"}, "district") === "Not Found");'
- - text: 'checkObj({pet: "kitten", bed: "sleigh"}, "gift") should return "Not Found".'
- testString: 'assert(checkObj({pet: "kitten", bed: "sleigh"}, "gift") === "Not Found");'
+`checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift")` should return `"pony"`.
+
+```js
+assert(
+ checkObj({ gift: 'pony', pet: 'kitten', bed: 'sleigh' }, 'gift') === 'pony'
+);
```
-
+`checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet")` should return `"kitten"`.
-## Challenge Seed
-
+```js
+assert(
+ checkObj({ gift: 'pony', pet: 'kitten', bed: 'sleigh' }, 'pet') === 'kitten'
+);
+```
-
-
-
-
-## Solution
-
+# --solutions--
```js
function checkObj(obj, checkProp) {
@@ -78,5 +93,3 @@ function checkObj(obj, checkProp) {
}
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md
index b76588238d..5dfe55a0c0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cWPVaUR'
forumTopicId: 18331
---
-## Description
-
-In JavaScript, String values are immutable, which means that they cannot be altered once created.
+# --description--
+
+In JavaScript, `String` values are immutable, which means that they cannot be altered once created.
+
For example, the following code:
```js
@@ -16,38 +17,40 @@ var myStr = "Bob";
myStr[0] = "J";
```
-cannot change the value of myStr to "Job", because the contents of myStr cannot be altered. Note that this does not mean that myStr cannot be changed, just that the individual characters of a string literal cannot be changed. The only way to change myStr would be to assign it with a new string, like this:
+cannot change the value of `myStr` to "Job", because the contents of `myStr` cannot be altered. Note that this does *not* mean that `myStr` cannot be changed, just that the individual characters of a string literal cannot be changed. The only way to change `myStr` would be to assign it with a new string, like this:
```js
var myStr = "Bob";
myStr = "Job";
```
-
+# --instructions--
-## Instructions
-
-Correct the assignment to myStr so it contains the string value of Hello World using the approach shown in the example above.
-
+Correct the assignment to `myStr` so it contains the string value of `Hello World` using the approach shown in the example above.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: myStr should have a value of Hello World.
- testString: assert(myStr === "Hello World");
- - text: You should not change the code above the specified comment.
- testString: assert(/myStr = "Jello World"/.test(code));
+`myStr` should have a value of `Hello World`.
+```js
+assert(myStr === 'Hello World');
```
-
+You should not change the code above the specified comment.
-## Challenge Seed
-
+```js
+assert(/myStr = "Jello World"/.test(code));
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(v){return "myStr = " + v;})(myStr);
+```
+
+## --seed-contents--
```js
// Setup
@@ -56,30 +59,11 @@ var myStr = "Jello World";
// Only change code below this line
myStr[0] = "H"; // Change this line
// Only change code above this line
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myStr = "Jello World";
myStr = "Hello World";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md
index 097fd26dd0..de5ce1cf13 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.md
@@ -6,35 +6,40 @@ videoUrl: 'https://scrimba.com/c/c9Me8t4'
forumTopicId: 301176
---
-## Description
-
-Another data type is the Boolean. Booleans may only be one of two values: true or false. They are basically little on-off switches, where true is "on" and false is "off." These two states are mutually exclusive.
-Note Boolean values are never written with quotes. The strings"true" and "false" are not Boolean and have no special meaning in JavaScript.
-
+# --description--
-## Instructions
-
-Modify the welcomeToBooleans function so that it returns true instead of false when the run button is clicked.
-
+Another data type is the Boolean. `Booleans` may only be one of two values: `true` or `false`. They are basically little on-off switches, where `true` is "on" and `false` is "off." These two states are mutually exclusive.
-## Tests
-
+**Note**
+`Boolean` values are never written with quotes. The `strings` `"true"` and `"false"` are not `Boolean` and have no special meaning in JavaScript.
-```yml
-tests:
- - text: The welcomeToBooleans() function should return a boolean (true/false) value.
- testString: assert(typeof welcomeToBooleans() === 'boolean');
- - text: welcomeToBooleans() should return true.
- testString: assert(welcomeToBooleans() === true);
+# --instructions--
+Modify the `welcomeToBooleans` function so that it returns `true` instead of `false` when the run button is clicked.
+
+# --hints--
+
+The `welcomeToBooleans()` function should return a boolean (true/false) value.
+
+```js
+assert(typeof welcomeToBooleans() === 'boolean');
```
-
+`welcomeToBooleans()` should return true.
-## Challenge Seed
-
+```js
+assert(welcomeToBooleans() === true);
+```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function welcomeToBooleans() {
return true; // Change this line
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md
index 1e95af1ac1..70fb45531a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md
@@ -6,13 +6,17 @@ videoUrl: 'https://scrimba.com/c/cd6GDcD'
forumTopicId: 18334
---
-## Description
-
+# --description--
+
In JavaScript all variables and function names are case sensitive. This means that capitalization matters.
-MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you do not use this language feature.
+
+`MYVAR` is not the same as `MyVar` nor `myvar`. It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you *do not* use this language feature.
+
Best Practice
+
Write variable names in JavaScript in camelCase. In camelCase, multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized.
-Examples:
+
+**Examples:**
```js
var someVariable;
@@ -20,39 +24,54 @@ var anotherVariableName;
var thisVariableNameIsSoLong;
```
-
+# --instructions--
-## Instructions
-
-Modify the existing declarations and assignments so their names use camelCase. Do not create any new variables.
-
+Modify the existing declarations and assignments so their names use camelCase.
+Do not create any new variables.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: studlyCapVar should be defined and have a value of 10.
- testString: assert(typeof studlyCapVar !== 'undefined' && studlyCapVar === 10);
- - text: properCamelCase should be defined and have a value of "A String".
- testString: assert(typeof properCamelCase !== 'undefined' && properCamelCase === "A String");
- - text: titleCaseOver should be defined and have a value of 9000.
- testString: assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000);
- - text: studlyCapVar should use camelCase in both declaration and assignment sections.
- testString: assert(code.match(/studlyCapVar/g).length === 2);
- - text: properCamelCase should use camelCase in both declaration and assignment sections.
- testString: assert(code.match(/properCamelCase/g).length === 2);
- - text: titleCaseOver should use camelCase in both declaration and assignment sections.
- testString: assert(code.match(/titleCaseOver/g).length === 2);
+`studlyCapVar` should be defined and have a value of `10`.
+```js
+assert(typeof studlyCapVar !== 'undefined' && studlyCapVar === 10);
```
-
+`properCamelCase` should be defined and have a value of `"A String"`.
-## Challenge Seed
-
+```js
+assert(
+ typeof properCamelCase !== 'undefined' && properCamelCase === 'A String'
+);
+```
-
+`titleCaseOver` should be defined and have a value of `9000`.
+
+```js
+assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000);
+```
+
+`studlyCapVar` should use camelCase in both declaration and assignment sections.
+
+```js
+assert(code.match(/studlyCapVar/g).length === 2);
+```
+
+`properCamelCase` should use camelCase in both declaration and assignment sections.
+
+```js
+assert(code.match(/properCamelCase/g).length === 2);
+```
+
+`titleCaseOver` should use camelCase in both declaration and assignment sections.
+
+```js
+assert(code.match(/titleCaseOver/g).length === 2);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Variable declarations
@@ -66,15 +85,7 @@ PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var studlyCapVar;
@@ -85,5 +96,3 @@ studlyCapVar = 10;
properCamelCase = "A String";
titleCaseOver = 9000;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md
index 430712ec91..407e88d248 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/ce2p7cL'
forumTopicId: 301177
---
-## Description
-
-A function can include the return statement but it does not have to. In the case that the function doesn't have a return statement, when you call it, the function processes the inner code but the returned value is undefined.
-Example
+# --description--
+
+A function can include the `return` statement but it does not have to. In the case that the function doesn't have a `return` statement, when you call it, the function processes the inner code but the returned value is `undefined`.
+
+**Example**
```js
var sum = 0;
@@ -19,36 +20,43 @@ function addSum(num) {
addSum(3); // sum will be modified but returned value is undefined
```
-addSum is a function without a return statement. The function will change the global sum variable but the returned value of the function is undefined.
-
+`addSum` is a function without a `return` statement. The function will change the global `sum` variable but the returned value of the function is `undefined`.
-## Instructions
-
-Create a function addFive without any arguments. This function adds 5 to the sum variable, but its returned value is undefined.
-
+# --instructions--
-## Tests
-
+Create a function `addFive` without any arguments. This function adds 5 to the `sum` variable, but its returned value is `undefined`.
-```yml
-tests:
- - text: addFive should be a function.
- testString: assert(typeof addFive === 'function');
- - text: Once both functions have ran, the sum should be equal to 8.
- testString: assert(sum === 8);
- - text: Returned value from addFive should be undefined.
- testString: assert(addFive() === undefined);
- - text: Inside the addFive function, you should add 5 to the sum variable.
- testString: assert(__helpers.removeWhiteSpace(addFive.toString()).match(/sum=sum\+5|sum\+=5/));
+# --hints--
+`addFive` should be a function.
+
+```js
+assert(typeof addFive === 'function');
```
-
+Once both functions have ran, the `sum` should be equal to 8.
-## Challenge Seed
-
+```js
+assert(sum === 8);
+```
-
+Returned value from `addFive` should be `undefined`.
+
+```js
+assert(addFive() === undefined);
+```
+
+Inside the `addFive` function, you should add `5` to the `sum` variable.
+
+```js
+assert(
+ __helpers.removeWhiteSpace(addFive.toString()).match(/sum=sum\+5|sum\+=5/)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -67,12 +75,7 @@ addThree();
addFive();
```
-
-
-
-## Solution
-
-
+# --solutions--
```js
var sum = 0;
@@ -88,5 +91,3 @@ function addFive() {
addThree();
addFive();
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md
index 3ed7cf9923..2960b6f4d4 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md
@@ -6,38 +6,53 @@ videoUrl: 'https://scrimba.com/c/cBa2JAL'
forumTopicId: 18335
---
-## Description
-
-When JavaScript variables are declared, they have an initial value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means "Not a Number". If you concatenate a string with an undefined variable, you will get a literal string of "undefined".
-
+# --description--
-## Instructions
-
-Initialize the three variables a, b, and c with 5, 10, and "I am a" respectively so that they will not be undefined.
-
+When JavaScript variables are declared, they have an initial value of `undefined`. If you do a mathematical operation on an `undefined` variable your result will be `NaN` which means "Not a Number". If you concatenate a string with an `undefined` variable, you will get a literal string of `"undefined"`.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: a should be defined and evaluated to have the value of 6.
- testString: assert(typeof a === 'number' && a === 6);
- - text: b should be defined and evaluated to have the value of 15.
- testString: assert(typeof b === 'number' && b === 15);
- - text: c should not contain undefined and should have a value of "I am a String!"
- testString: assert(!/undefined/.test(c) && c === "I am a String!");
- - text: You should not change code below the specified comment.
- testString: assert(/a = a \+ 1;/.test(code) && /b = b \+ 5;/.test(code) && /c = c \+ " String!";/.test(code));
+Initialize the three variables `a`, `b`, and `c` with `5`, `10`, and `"I am a"` respectively so that they will not be `undefined`.
+# --hints--
+
+`a` should be defined and evaluated to have the value of `6`.
+
+```js
+assert(typeof a === 'number' && a === 6);
```
-
+`b` should be defined and evaluated to have the value of `15`.
-## Challenge Seed
-
+```js
+assert(typeof b === 'number' && b === 15);
+```
-
+`c` should not contain `undefined` and should have a value of "I am a String!"
+
+```js
+assert(!/undefined/.test(c) && c === 'I am a String!');
+```
+
+You should not change code below the specified comment.
+
+```js
+assert(
+ /a = a \+ 1;/.test(code) &&
+ /b = b \+ 5;/.test(code) &&
+ /c = c \+ " String!";/.test(code)
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = '" + c + "'"; })(a,b,c);
+```
+
+## --seed-contents--
```js
// Only change code below this line
@@ -51,23 +66,7 @@ b = b + 5;
c = c + " String!";
```
-
-
-
-### After Test
-
-
-```js
-(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = '" + c + "'"; })(a,b,c);
-```
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var a = 5;
@@ -77,5 +76,3 @@ a = a + 1;
b = b + 5;
c = c + " String!";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md
index eec44540df..0b723aa89f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/c9yEJT4'
forumTopicId: 18336
---
-## Description
-
+# --description--
+
After you've created a JavaScript object, you can update its properties at any time just like you would update any other variable. You can use either dot or bracket notation to update.
-For example, let's look at ourDog:
+
+For example, let's look at `ourDog`:
```js
var ourDog = {
@@ -20,35 +21,35 @@ var ourDog = {
};
```
-Since he's a particularly happy dog, let's change his name to "Happy Camper". Here's how we update his object's name property:
-ourDog.name = "Happy Camper"; or
-ourDog["name"] = "Happy Camper";
-Now when we evaluate ourDog.name, instead of getting "Camper", we'll get his new name, "Happy Camper".
-
+Since he's a particularly happy dog, let's change his name to "Happy Camper". Here's how we update his object's name property: `ourDog.name = "Happy Camper";` or `ourDog["name"] = "Happy Camper";` Now when we evaluate `ourDog.name`, instead of getting "Camper", we'll get his new name, "Happy Camper".
-## Instructions
-
-Update the myDog object's name property. Let's change her name from "Coder" to "Happy Coder". You can use either dot or bracket notation.
-
+# --instructions--
-## Tests
-
+Update the `myDog` object's name property. Let's change her name from "Coder" to "Happy Coder". You can use either dot or bracket notation.
-```yml
-tests:
- - text: You should update myDog's "name" property to equal "Happy Coder".
- testString: assert(/happy coder/gi.test(myDog.name));
- - text: You should not edit the myDog definition.
- testString: 'assert(/"name": "Coder"/.test(code));'
+# --hints--
+You should update `myDog`'s `"name"` property to equal "Happy Coder".
+
+```js
+assert(/happy coder/gi.test(myDog.name));
```
-
+You should not edit the `myDog` definition.
-## Challenge Seed
-
+```js
+assert(/"name": "Coder"/.test(code));
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(z){return z;})(myDog);
+```
+
+## --seed-contents--
```js
// Setup
@@ -60,27 +61,9 @@ var myDog = {
};
// Only change code below this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myDog = {
@@ -91,5 +74,3 @@ var myDog = {
};
myDog.name = "Happy Coder";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md
index 61f2352ef4..30767fcb4d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md
@@ -6,11 +6,13 @@ videoUrl: 'https://scrimba.com/c/ca8JwhW'
forumTopicId: 18341
---
-## Description
-
-Bracket notation is a way to get a character at a specific index within a string.
+# --description--
+
+Bracket notation is a way to get a character at a specific `index` within a string.
+
Most modern programming languages, like JavaScript, don't start counting at 1 like humans do. They start at 0. This is referred to as Zero-based indexing.
-For example, the character at index 0 in the word "Charles" is "C". So if var firstName = "Charles", you can get the value of the first letter of the string by using firstName[0].
+
+For example, the character at index 0 in the word "Charles" is "C". So if `var firstName = "Charles"`, you can get the value of the first letter of the string by using `firstName[0]`.
Example:
@@ -19,32 +21,35 @@ var firstName = "Charles";
var firstLetter = firstName[0]; // firstLetter is "C"
```
-
+# --instructions--
-## Instructions
-
-Use bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName.
-Hint: Try looking at the example above if you get stuck.
-
+Use bracket notation to find the first character in the `lastName` variable and assign it to `firstLetterOfLastName`.
-## Tests
-
+**Hint:** Try looking at the example above if you get stuck.
-```yml
-tests:
- - text: The firstLetterOfLastName variable should have the value of L.
- testString: assert(firstLetterOfLastName === 'L');
- - text: You should use bracket notation.
- testString: assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
+# --hints--
+The `firstLetterOfLastName` variable should have the value of `L`.
+
+```js
+assert(firstLetterOfLastName === 'L');
```
-
+You should use bracket notation.
-## Challenge Seed
-
+```js
+assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(v){return v;})(firstLetterOfLastName);
+```
+
+## --seed-contents--
```js
// Setup
@@ -53,26 +58,9 @@ var lastName = "Lovelace";
// Only change code below this line
firstLetterOfLastName = lastName; // Change this line
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var firstLetterOfLastName = "";
@@ -81,5 +69,3 @@ var lastName = "Lovelace";
// Only change code below this line
firstLetterOfLastName = lastName[0];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md
index 90d4148343..fdd9ccb05f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cBZQGcv'
forumTopicId: 18342
---
-## Description
-
+# --description--
+
In order to get the last letter of a string, you can subtract one from the string's length.
-For example, if var firstName = "Charles", you can get the value of the last letter of the string by using firstName[firstName.length - 1].
+
+For example, if `var firstName = "Charles"`, you can get the value of the last letter of the string by using `firstName[firstName.length - 1]`.
Example:
@@ -18,32 +19,35 @@ var firstName = "Charles";
var lastLetter = firstName[firstName.length - 1]; // lastLetter is "s"
```
-
+# --instructions--
-## Instructions
-
-Use bracket notation to find the last character in the lastName variable.
-Hint: Try looking at the example above if you get stuck.
-
+Use bracket notation to find the last character in the `lastName` variable.
-## Tests
-
+**Hint:** Try looking at the example above if you get stuck.
-```yml
-tests:
- - text: lastLetterOfLastName should be "e".
- testString: assert(lastLetterOfLastName === "e");
- - text: You should use .length to get the last letter.
- testString: assert(code.match(/\.length/g).length > 0);
+# --hints--
+`lastLetterOfLastName` should be "e".
+
+```js
+assert(lastLetterOfLastName === 'e');
```
-
+You should use `.length` to get the last letter.
-## Challenge Seed
-
+```js
+assert(code.match(/\.length/g).length > 0);
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(v){return v;})(lastLetterOfLastName);
+```
+
+## --seed-contents--
```js
// Setup
@@ -51,31 +55,11 @@ var lastName = "Lovelace";
// Only change code below this line
var lastLetterOfLastName = lastName; // Change this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var lastName = "Lovelace";
var lastLetterOfLastName = lastName[lastName.length - 1];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md
index e412e1baf4..60dcc4456e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cWPVJua'
forumTopicId: 18343
---
-## Description
-
+# --description--
+
You can also use bracket notation to get the character at other positions within a string.
-Remember that computers start counting at 0, so the first character is actually the zeroth character.
+
+Remember that computers start counting at `0`, so the first character is actually the zeroth character.
Example:
@@ -18,32 +19,35 @@ var firstName = "Ada";
var secondLetterOfFirstName = firstName[1]; // secondLetterOfFirstName is "d"
```
-
+# --instructions--
-## Instructions
-
-Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable using bracket notation.
-Hint: Try looking at the example above if you get stuck.
-
+Let's try to set `thirdLetterOfLastName` to equal the third letter of the `lastName` variable using bracket notation.
-## Tests
-
+**Hint:** Try looking at the example above if you get stuck.
-```yml
-tests:
- - text: The thirdLetterOfLastName variable should have the value of v.
- testString: assert(thirdLetterOfLastName === 'v');
- - text: You should use bracket notation.
- testString: assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
+# --hints--
+The `thirdLetterOfLastName` variable should have the value of `v`.
+
+```js
+assert(thirdLetterOfLastName === 'v');
```
-
+You should use bracket notation.
-## Challenge Seed
-
+```js
+assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(v){return v;})(thirdLetterOfLastName);
+```
+
+## --seed-contents--
```js
// Setup
@@ -51,31 +55,11 @@ var lastName = "Lovelace";
// Only change code below this line
var thirdLetterOfLastName = lastName; // Change this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var lastName = "Lovelace";
var thirdLetterOfLastName = lastName[2];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md
index a886608a1d..fef721418a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md
@@ -6,10 +6,11 @@ videoUrl: 'https://scrimba.com/c/cw4vkh9'
forumTopicId: 18344
---
-## Description
-
+# --description--
+
You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character.
-For example, you can get the value of the third-to-last letter of the var firstName = "Charles" string by using firstName[firstName.length - 3]
+
+For example, you can get the value of the third-to-last letter of the `var firstName = "Charles"` string by using `firstName[firstName.length - 3]`
Example:
@@ -18,32 +19,35 @@ var firstName = "Charles";
var thirdToLastLetter = firstName[firstName.length - 3]; // thirdToLastLetter is "l"
```
-
+# --instructions--
-## Instructions
-
-Use bracket notation to find the second-to-last character in the lastName string.
-Hint: Try looking at the example above if you get stuck.
-
+Use bracket notation to find the second-to-last character in the `lastName` string.
-## Tests
-
+**Hint:** Try looking at the example above if you get stuck.
-```yml
-tests:
- - text: secondToLastLetterOfLastName should be "c".
- testString: assert(secondToLastLetterOfLastName === 'c');
- - text: You should use .length to get the second last letter.
- testString: assert(code.match(/\.length/g).length > 0);
+# --hints--
+`secondToLastLetterOfLastName` should be "c".
+
+```js
+assert(secondToLastLetterOfLastName === 'c');
```
-
+You should use `.length` to get the second last letter.
-## Challenge Seed
-
+```js
+assert(code.match(/\.length/g).length > 0);
+```
-
+# --seed--
+
+## --after-user-code--
+
+```js
+(function(v){return v;})(secondToLastLetterOfLastName);
+```
+
+## --seed-contents--
```js
// Setup
@@ -51,31 +55,11 @@ var lastName = "Lovelace";
// Only change code below this line
var secondToLastLetterOfLastName = lastName; // Change this line
-
-
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var lastName = "Lovelace";
var secondToLastLetterOfLastName = lastName[lastName.length - 2];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md
index a246f88fde..32bc38eb82 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.md
@@ -6,13 +6,17 @@ videoUrl: 'https://scrimba.com/c/cy87mf3'
forumTopicId: 18348
---
-## Description
-
-If statements are used to make decisions in code. The keyword if tells JavaScript to execute the code in the curly braces under certain conditions, defined in the parentheses. These conditions are known as Boolean conditions and they may only be true or false.
-When the condition evaluates to true, the program executes the statement inside the curly braces. When the Boolean condition evaluates to false, the statement inside the curly braces will not execute.
-Pseudocode
-
if (condition is true) { statement is executed }
-Example
+# --description--
+
+`If` statements are used to make decisions in code. The keyword `if` tells JavaScript to execute the code in the curly braces under certain conditions, defined in the parentheses. These conditions are known as `Boolean` conditions and they may only be `true` or `false`.
+
+When the condition evaluates to `true`, the program executes the statement inside the curly braces. When the Boolean condition evaluates to `false`, the statement inside the curly braces will not execute.
+
+**Pseudocode**
+
+
if (condition is true) { statement is executed }
+
+**Example**
```js
function test (myCondition) {
@@ -25,38 +29,47 @@ test(true); // returns "It was true"
test(false); // returns "It was false"
```
-When test is called with a value of true, the if statement evaluates myCondition to see if it is true or not. Since it is true, the function returns "It was true". When we call test with a value of false, myCondition is nottrue and the statement in the curly braces is not executed and the function returns "It was false".
-
+When `test` is called with a value of `true`, the `if` statement evaluates `myCondition` to see if it is `true` or not. Since it is `true`, the function returns `"It was true"`. When we call `test` with a value of `false`, `myCondition` is *not* `true` and the statement in the curly braces is not executed and the function returns `"It was false"`.
-## Instructions
-
-Create an if statement inside the function to return "Yes, that was true" if the parameter wasThatTrue is true and return "No, that was false" otherwise.
-
+# --instructions--
-## Tests
-
+Create an `if` statement inside the function to return `"Yes, that was true"` if the parameter `wasThatTrue` is `true` and return `"No, that was false"` otherwise.
-```yml
-tests:
- - text: trueOrFalse should be a function
- testString: assert(typeof trueOrFalse === "function");
- - text: trueOrFalse(true) should return a string
- testString: assert(typeof trueOrFalse(true) === "string");
- - text: trueOrFalse(false) should return a string
- testString: assert(typeof trueOrFalse(false) === "string");
- - text: trueOrFalse(true) should return "Yes, that was true"
- testString: assert(trueOrFalse(true) === "Yes, that was true");
- - text: trueOrFalse(false) should return "No, that was false"
- testString: assert(trueOrFalse(false) === "No, that was false");
+# --hints--
+`trueOrFalse` should be a function
+
+```js
+assert(typeof trueOrFalse === 'function');
```
-
+`trueOrFalse(true)` should return a string
-## Challenge Seed
-
+```js
+assert(typeof trueOrFalse(true) === 'string');
+```
-
+`trueOrFalse(false)` should return a string
+
+```js
+assert(typeof trueOrFalse(false) === 'string');
+```
+
+`trueOrFalse(true)` should return "Yes, that was true"
+
+```js
+assert(trueOrFalse(true) === 'Yes, that was true');
+```
+
+`trueOrFalse(false)` should return "No, that was false"
+
+```js
+assert(trueOrFalse(false) === 'No, that was false');
+```
+
+# --seed--
+
+## --seed-contents--
```js
function trueOrFalse(wasThatTrue) {
@@ -69,15 +82,7 @@ function trueOrFalse(wasThatTrue) {
}
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function trueOrFalse(wasThatTrue) {
@@ -87,5 +92,3 @@ function trueOrFalse(wasThatTrue) {
return "No, that was false";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md
index 991874f04e..287d915f49 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cyWJBT4'
forumTopicId: 301179
---
-## Description
-
+# --description--
+
In the previous challenge, you used a single conditional operator. You can also chain them together to check for multiple conditions.
+
The following function uses if, else if, and else statements to check multiple conditions:
```js
@@ -43,35 +44,39 @@ function findGreaterOrEqual(a, b) {
}
```
-
+# --instructions--
-## Instructions
-
-In the checkSign function, use multiple conditional operators - following the recommended format used in findGreaterOrEqual - to check if a number is positive, negative or zero. The function should return "positive", "negative" or "zero".
-
+In the `checkSign` function, use multiple conditional operators - following the recommended format used in `findGreaterOrEqual` - to check if a number is positive, negative or zero. The function should return `"positive"`, `"negative"` or `"zero"`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: checkSign should use multiple conditional operators
- testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code));
- - text: checkSign(10) should return "positive". Note that capitalization matters
- testString: assert(checkSign(10) === 'positive');
- - text: checkSign(-12) should return "negative". Note that capitalization matters
- testString: assert(checkSign(-12) === 'negative');
- - text: checkSign(0) should return "zero". Note that capitalization matters
- testString: assert(checkSign(0) === 'zero');
+`checkSign` should use multiple conditional operators
+```js
+assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code));
```
-
+`checkSign(10)` should return "positive". Note that capitalization matters
-## Challenge Seed
-
+```js
+assert(checkSign(10) === 'positive');
+```
-
+`checkSign(-12)` should return "negative". Note that capitalization matters
+
+```js
+assert(checkSign(-12) === 'negative');
+```
+
+`checkSign(0)` should return "zero". Note that capitalization matters
+
+```js
+assert(checkSign(0) === 'zero');
+```
+
+# --seed--
+
+## --seed-contents--
```js
function checkSign(num) {
@@ -81,19 +86,10 @@ function checkSign(num) {
checkSign(10);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function checkSign(num) {
return (num > 0) ? 'positive' : (num < 0) ? 'negative' : 'zero';
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md
index f043708d27..98183edf24 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md
@@ -5,14 +5,13 @@ challengeType: 1
forumTopicId: 305925
---
-## Description
-
+# --description--
-In a [previous challenge](/learn/javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion), you learned how to use recursion to replace a for loop. Now, let's look at a more complex function that returns an array of consecutive integers starting with 1 through the number passed to the function.
+In a [previous challenge](/learn/javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion), you learned how to use recursion to replace a for loop. Now, let's look at a more complex function that returns an array of consecutive integers starting with `1` through the number passed to the function.
-As mentioned in the previous challenge, there will be a base case. The base case tells the recursive function when it no longer needs to call itself. It is a simple case where the return value is already known. There will also be a recursive call which executes the original function with different arguments. If the function is written correctly, eventually the base case will be reached.
+As mentioned in the previous challenge, there will be a base case. The base case tells the recursive function when it no longer needs to call itself. It is a simple case where the return value is already known. There will also be a recursive call which executes the original function with different arguments. If the function is written correctly, eventually the base case will be reached.
-For example, say you want to write a recursive function that returns an array containing the numbers 1 through n. This function will need to accept an argument, n, representing the final number. Then it will need to call itself with progressively smaller values of n until it reaches 1. You could write the function as follows:
+For example, say you want to write a recursive function that returns an array containing the numbers `1` through `n`. This function will need to accept an argument, `n`, representing the final number. Then it will need to call itself with progressively smaller values of `n` until it reaches `1`. You could write the function as follows:
```javascript
function countup(n) {
@@ -27,46 +26,55 @@ function countup(n) {
console.log(countup(5)); // [ 1, 2, 3, 4, 5 ]
```
-At first, this seems counterintuitive since the value of `n` decreases, but the values in the final array are increasing. This happens because the push happens last, after the recursive call has returned. At the point where `n` is pushed into the array, `countup(n - 1)` has already been evaluated and returned `[1, 2, ..., n - 1]`.
+At first, this seems counterintuitive since the value of `n` *decreases*, but the values in the final array are *increasing*. This happens because the push happens last, after the recursive call has returned. At the point where `n` is pushed into the array, `countup(n - 1)` has already been evaluated and returned `[1, 2, ..., n - 1]`.
-
+# --instructions--
-## Instructions
-
+We have defined a function called `countdown` with one parameter (`n`). The function should use recursion to return an array containing the integers `n` through `1` based on the `n` parameter. If the function is called with a number less than 1, the function should return an empty array. For example, calling this function with `n = 5` should return the array `[5, 4, 3, 2, 1]`. Your function must use recursion by calling itself and must not use loops of any kind.
-We have defined a function called countdown with one parameter (n). The function should use recursion to return an array containing the integers n through 1 based on the n parameter. If the function is called with a number less than 1, the function should return an empty array.
-For example, calling this function with n = 5 should return the array [5, 4, 3, 2, 1].
-Your function must use recursion by calling itself and must not use loops of any kind.
+# --hints--
-
-
-## Tests
-
-
-``` yml
-tests:
- - text: countdown(-1) should return an empty array.
- testString: assert.isEmpty(countdown(-1));
- - text: countdown(10) should return [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
- testString: assert.deepStrictEqual(countdown(10), [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);
- - text: countdown(5) should return [5, 4, 3, 2, 1]
- testString: assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]);
- - text: Your code should not rely on any kind of loops (for, while or higher order functions such as forEach, map, filter, and reduce).
- testString: assert(!__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g));
- - text: You should use recursion to solve this problem.
- testString: assert(__helpers.removeJSComments(countdown.toString()).match(/countdown\s*\(.+\)/));
-```
-
-
-
-## Challenge Seed
-
-
-
+`countdown(-1)` should return an empty array.
```js
+assert.isEmpty(countdown(-1));
+```
+`countdown(10)` should return `[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]`
+```js
+assert.deepStrictEqual(countdown(10), [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);
+```
+
+`countdown(5)` should return `[5, 4, 3, 2, 1]`
+
+```js
+assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]);
+```
+
+Your code should not rely on any kind of loops (`for`, `while` or higher order functions such as `forEach`, `map`, `filter`, and `reduce`).
+
+```js
+assert(
+ !__helpers
+ .removeJSComments(code)
+ .match(/for|while|forEach|map|filter|reduce/g)
+);
+```
+
+You should use recursion to solve this problem.
+
+```js
+assert(
+ __helpers.removeJSComments(countdown.toString()).match(/countdown\s*\(.+\)/)
+);
+```
+
+# --seed--
+
+## --seed-contents--
+
+```js
// Only change code below this line
function countdown(n){
return;
@@ -74,17 +82,10 @@ function countdown(n){
// Only change code above this line
```
-
-
-
-
-## Solution
-
+# --solutions--
```js
function countdown(n){
return n < 1 ? [] : [n].concat(countdown(n - 1));
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md
index 74f6b7fc9c..8467d4c5e5 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md
@@ -5,43 +5,63 @@ challengeType: 1
forumTopicId: 301180
---
-## Description
-
+# --description--
Continuing from the previous challenge, we provide you another opportunity to create a recursive function to solve a problem.
-
+# --instructions--
-## Instructions
-
-We have defined a function named rangeOfNumbers with two parameters. The function should return an array of integers which begins with a number represented by the startNum parameter and ends with a number represented by the endNum parameter. The starting number will always be less than or equal to the ending number. Your function must use recursion by calling itself and not use loops of any kind. It should also work for cases where both startNum and endNum are the same.
-
+We have defined a function named `rangeOfNumbers` with two parameters. The function should return an array of integers which begins with a number represented by the `startNum` parameter and ends with a number represented by the `endNum` parameter. The starting number will always be less than or equal to the ending number. Your function must use recursion by calling itself and not use loops of any kind. It should also work for cases where both `startNum` and `endNum` are the same.
-## Tests
-
+# --hints--
-``` yml
-tests:
- - text: Your function should return an array.
- testString: assert(Array.isArray(rangeOfNumbers(5, 10)));
- - text: Your code should not use any loop syntax (for or while or higher order functions such as forEach, map, filter, or reduce).
- testString: assert(!__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g));
- - text: rangeOfNumbers should use recursion (call itself) to solve this challenge.
- testString: assert(__helpers.removeJSComments(rangeOfNumbers.toString()).match(/rangeOfNumbers\s*\(.+\)/));
- - text: rangeOfNumbers(1, 5) should return [1, 2, 3, 4, 5].
- testString: assert.deepStrictEqual(rangeOfNumbers(1, 5), [1, 2, 3, 4, 5]);
- - text: rangeOfNumbers(6, 9) should return [6, 7, 8, 9].
- testString: assert.deepStrictEqual(rangeOfNumbers(6, 9), [6, 7, 8, 9]);
- - text: rangeOfNumbers(4, 4) should return [4].
- testString: assert.deepStrictEqual(rangeOfNumbers(4, 4), [4]);
+Your function should return an array.
+
+```js
+assert(Array.isArray(rangeOfNumbers(5, 10)));
```
-
+Your code should not use any loop syntax (`for` or `while` or higher order functions such as `forEach`, `map`, `filter`, or `reduce`).
-## Challenge Seed
-
+```js
+assert(
+ !__helpers
+ .removeJSComments(code)
+ .match(/for|while|forEach|map|filter|reduce/g)
+);
+```
-
-
-
-
-## Solution
-
+# --solutions--
```js
function rangeOfNumbers(startNum, endNum) {
@@ -67,5 +82,3 @@ function rangeOfNumbers(startNum, endNum) {
}
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md
index 8961926e31..e2efa479bd 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md
@@ -5,11 +5,14 @@ challengeType: 1
forumTopicId: 301181
---
-## Description
-
+# --description--
+
The conditional operator, also called the ternary operator, can be used as a one line if-else expression.
+
The syntax is:
-condition ? expression-if-true : expression-if-false;
+
+`condition ? expression-if-true : expression-if-false;`
+
The following function uses an if-else statement to check a condition:
```js
@@ -23,7 +26,7 @@ function findGreater(a, b) {
}
```
-This can be re-written using the conditional operator:
+This can be re-written using the `conditional operator`:
```js
function findGreater(a, b) {
@@ -31,34 +34,39 @@ function findGreater(a, b) {
}
```
-
+# --instructions--
-## Instructions
-
-Use the conditional operator in the checkEqual function to check if two numbers are equal or not. The function should return either "Equal" or "Not Equal".
-
+Use the `conditional operator` in the `checkEqual` function to check if two numbers are equal or not. The function should return either "Equal" or "Not Equal".
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: checkEqual should use the conditional operator
- testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code));
- - text: checkEqual(1, 2) should return "Not Equal"
- testString: assert(checkEqual(1, 2) === "Not Equal");
- - text: checkEqual(1, 1) should return "Equal"
- testString: assert(checkEqual(1, 1) === "Equal");
- - text: checkEqual(1, -1) should return "Not Equal"
- testString: assert(checkEqual(1, -1) === "Not Equal");
+`checkEqual` should use the `conditional operator`
+
+```js
+assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code));
```
-
+`checkEqual(1, 2)` should return "Not Equal"
-## Challenge Seed
-
+```js
+assert(checkEqual(1, 2) === 'Not Equal');
+```
-
+`checkEqual(1, 1)` should return "Equal"
+
+```js
+assert(checkEqual(1, 1) === 'Equal');
+```
+
+`checkEqual(1, -1)` should return "Not Equal"
+
+```js
+assert(checkEqual(1, -1) === 'Not Equal');
+```
+
+# --seed--
+
+## --seed-contents--
```js
function checkEqual(a, b) {
@@ -68,19 +76,10 @@ function checkEqual(a, b) {
checkEqual(1, 2);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function checkEqual(a, b) {
return a === b ? "Equal" : "Not Equal";
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md
index 19a3bb6dcf..92015817a8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md
@@ -6,45 +6,59 @@ videoUrl: 'https://scrimba.com/c/c6K4Kh3'
forumTopicId: 301182
---
-## Description
-
-The parseInt() function parses a string and returns an integer. It takes a second argument for the radix, which specifies the base of the number in the string. The radix can be an integer between 2 and 36.
+# --description--
+
+The `parseInt()` function parses a string and returns an integer. It takes a second argument for the radix, which specifies the base of the number in the string. The radix can be an integer between 2 and 36.
+
The function call looks like:
-parseInt(string, radix);
+
+`parseInt(string, radix);`
+
And here's an example:
-var a = parseInt("11", 2);
+
+`var a = parseInt("11", 2);`
+
The radix variable says that "11" is in the binary system, or base 2. This example converts the string "11" to an integer 3.
-
-## Instructions
-
-Use parseInt() in the convertToInteger function so it converts a binary number to an integer and returns it.
-
+# --instructions--
-## Tests
-
+Use `parseInt()` in the `convertToInteger` function so it converts a binary number to an integer and returns it.
-```yml
-tests:
- - text: convertToInteger should use the parseInt() function
- testString: assert(/parseInt/g.test(code));
- - text: convertToInteger("10011") should return a number
- testString: assert(typeof(convertToInteger("10011")) === "number");
- - text: convertToInteger("10011") should return 19
- testString: assert(convertToInteger("10011") === 19);
- - text: convertToInteger("111001") should return 57
- testString: assert(convertToInteger("111001") === 57);
- - text: convertToInteger("JamesBond") should return NaN
- testString: assert.isNaN(convertToInteger("JamesBond"));
+# --hints--
+`convertToInteger` should use the `parseInt()` function
+
+```js
+assert(/parseInt/g.test(code));
```
-
+`convertToInteger("10011")` should return a number
-## Challenge Seed
-
+```js
+assert(typeof convertToInteger('10011') === 'number');
+```
-
+`convertToInteger("10011")` should return 19
+
+```js
+assert(convertToInteger('10011') === 19);
+```
+
+`convertToInteger("111001")` should return 57
+
+```js
+assert(convertToInteger('111001') === 57);
+```
+
+`convertToInteger("JamesBond")` should return NaN
+
+```js
+assert.isNaN(convertToInteger('JamesBond'));
+```
+
+# --seed--
+
+## --seed-contents--
```js
function convertToInteger(str) {
@@ -54,19 +68,10 @@ function convertToInteger(str) {
convertToInteger("10011");
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function convertToInteger(str) {
return parseInt(str, 2);
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md
index 46b373a3ac..908de0c398 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md
@@ -6,42 +6,53 @@ videoUrl: 'https://scrimba.com/c/cm83LSW'
forumTopicId: 301183
---
-## Description
-
-The parseInt() function parses a string and returns an integer. Here's an example:
-var a = parseInt("007");
-The above function converts the string "007" to an integer 7. If the first character in the string can't be converted into a number, then it returns NaN.
-
+# --description--
-## Instructions
-
-Use parseInt() in the convertToInteger function so it converts the input string str into an integer, and returns it.
-
+The `parseInt()` function parses a string and returns an integer. Here's an example:
-## Tests
-
+`var a = parseInt("007");`
-```yml
-tests:
- - text: convertToInteger should use the parseInt() function
- testString: assert(/parseInt/g.test(code));
- - text: convertToInteger("56") should return a number
- testString: assert(typeof(convertToInteger("56")) === "number");
- - text: convertToInteger("56") should return 56
- testString: assert(convertToInteger("56") === 56);
- - text: convertToInteger("77") should return 77
- testString: assert(convertToInteger("77") === 77);
- - text: convertToInteger("JamesBond") should return NaN
- testString: assert.isNaN(convertToInteger("JamesBond"));
+The above function converts the string "007" to an integer 7. If the first character in the string can't be converted into a number, then it returns `NaN`.
+# --instructions--
+
+Use `parseInt()` in the `convertToInteger` function so it converts the input string `str` into an integer, and returns it.
+
+# --hints--
+
+`convertToInteger` should use the `parseInt()` function
+
+```js
+assert(/parseInt/g.test(code));
```
-
+`convertToInteger("56")` should return a number
-## Challenge Seed
-
+```js
+assert(typeof convertToInteger('56') === 'number');
+```
-
+`convertToInteger("56")` should return 56
+
+```js
+assert(convertToInteger('56') === 56);
+```
+
+`convertToInteger("77")` should return 77
+
+```js
+assert(convertToInteger('77') === 77);
+```
+
+`convertToInteger("JamesBond")` should return NaN
+
+```js
+assert.isNaN(convertToInteger('JamesBond'));
+```
+
+# --seed--
+
+## --seed-contents--
```js
function convertToInteger(str) {
@@ -51,19 +62,10 @@ function convertToInteger(str) {
convertToInteger("56");
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function convertToInteger(str) {
return parseInt(str);
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md
index cfdfdcbbf2..2756daa8be 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cdBk8sM'
forumTopicId: 18373
---
-## Description
-
-Objects can be thought of as a key/value storage, like a dictionary. If you have tabular data, you can use an object to "lookup" values rather than a switch statement or an if/else chain. This is most useful when you know that your input data is limited to a certain range.
+# --description--
+
+Objects can be thought of as a key/value storage, like a dictionary. If you have tabular data, you can use an object to "lookup" values rather than a `switch` statement or an `if/else` chain. This is most useful when you know that your input data is limited to a certain range.
+
Here is an example of a simple reverse alphabet lookup:
```js
@@ -29,45 +30,71 @@ var value = 2;
alpha[value]; // "Y"
```
-
+# --instructions--
-## Instructions
-
-Convert the switch statement into an object called lookup. Use it to look up val and assign the associated string to the result variable.
-
+Convert the switch statement into an object called `lookup`. Use it to look up `val` and assign the associated string to the `result` variable.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: phoneticLookup("alpha") should equal "Adams"
- testString: assert(phoneticLookup("alpha") === 'Adams');
- - text: phoneticLookup("bravo") should equal "Boston"
- testString: assert(phoneticLookup("bravo") === 'Boston');
- - text: phoneticLookup("charlie") should equal "Chicago"
- testString: assert(phoneticLookup("charlie") === 'Chicago');
- - text: phoneticLookup("delta") should equal "Denver"
- testString: assert(phoneticLookup("delta") === 'Denver');
- - text: phoneticLookup("echo") should equal "Easy"
- testString: assert(phoneticLookup("echo") === 'Easy');
- - text: phoneticLookup("foxtrot") should equal "Frank"
- testString: assert(phoneticLookup("foxtrot") === 'Frank');
- - text: phoneticLookup("") should equal undefined
- testString: assert(typeof phoneticLookup("") === 'undefined');
- - text: You should not modify the return statement
- testString: assert(code.match(/return\sresult;/));
- - text: You should not use case, switch, or if statements
- testString: assert(!/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g,'')));
+`phoneticLookup("alpha")` should equal `"Adams"`
+```js
+assert(phoneticLookup('alpha') === 'Adams');
```
-
+`phoneticLookup("bravo")` should equal `"Boston"`
-## Challenge Seed
-
+```js
+assert(phoneticLookup('bravo') === 'Boston');
+```
-
+`phoneticLookup("charlie")` should equal `"Chicago"`
+
+```js
+assert(phoneticLookup('charlie') === 'Chicago');
+```
+
+`phoneticLookup("delta")` should equal `"Denver"`
+
+```js
+assert(phoneticLookup('delta') === 'Denver');
+```
+
+`phoneticLookup("echo")` should equal `"Easy"`
+
+```js
+assert(phoneticLookup('echo') === 'Easy');
+```
+
+`phoneticLookup("foxtrot")` should equal `"Frank"`
+
+```js
+assert(phoneticLookup('foxtrot') === 'Frank');
+```
+
+`phoneticLookup("")` should equal `undefined`
+
+```js
+assert(typeof phoneticLookup('') === 'undefined');
+```
+
+You should not modify the `return` statement
+
+```js
+assert(code.match(/return\sresult;/));
+```
+
+You should not use `case`, `switch`, or `if` statements
+
+```js
+assert(
+ !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, ''))
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Setup
@@ -102,15 +129,7 @@ function phoneticLookup(val) {
phoneticLookup("charlie");
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function phoneticLookup(val) {
@@ -130,5 +149,3 @@ function phoneticLookup(val) {
return result;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md
index 82fcd6de60..e7e2365199 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md
@@ -6,47 +6,81 @@ videoUrl: 'https://scrimba.com/c/caqn8zuP'
forumTopicId: 18377
---
-## Description
-
-We will now use our knowledge of strings to build a "Mad Libs" style word game we're calling "Word Blanks". You will create an (optionally humorous) "Fill in the Blanks" style sentence.
+# --description--
+
+We will now use our knowledge of strings to build a "[Mad Libs](https://en.wikipedia.org/wiki/Mad_Libs)" style word game we're calling "Word Blanks". You will create an (optionally humorous) "Fill in the Blanks" style sentence.
+
In a "Mad Libs" game, you are provided sentences with some missing words, like nouns, verbs, adjectives and adverbs. You then fill in the missing pieces with words of your choice in a way that the completed sentence makes sense.
-Consider this sentence - "It was really ____, and we ____ ourselves ____". This sentence has three missing pieces- an adjective, a verb and an adverb, and we can add words of our choice to complete it. We can then assign the completed sentence to a variable as follows:
+
+Consider this sentence - "It was really **\_\_\_\_**, and we **\_\_\_\_** ourselves **\_\_\_\_**". This sentence has three missing pieces- an adjective, a verb and an adverb, and we can add words of our choice to complete it. We can then assign the completed sentence to a variable as follows:
```js
var sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + ".";
```
-
+# --instructions--
-## Instructions
-
In this challenge, we provide you with a noun, a verb, an adjective and an adverb. You need to form a complete sentence using words of your choice, along with the words we provide.
-You will need to use the string concatenation operator + to build a new string, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb. You will then assign the formed string to the wordBlanks variable. You should not change the words assigned to the variables.
+
+You will need to use the string concatenation operator `+` to build a new string, using the provided variables: `myNoun`, `myAdjective`, `myVerb`, and `myAdverb`. You will then assign the formed string to the `wordBlanks` variable. You should not change the words assigned to the variables.
+
You will also need to account for spaces in your string, so that the final sentence has spaces between all the words. The result should be a complete sentence.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: wordBlanks should be a string.
- testString: assert(typeof wordBlanks === 'string');
- - text: You should not change the values assigned to myNoun, myVerb, myAdjective or myAdverb.
- testString: assert(myNoun === "dog" && myVerb === "ran" && myAdjective === "big" && myAdverb === "quickly");
- - text: You should not directly use the values "dog", "ran", "big", or "quickly" to create wordBlanks.
- testString: const newCode = removeAssignments(code); assert(!/dog/.test(newCode) && !/ran/.test(newCode) && !/big/.test(newCode) && !/quickly/.test(newCode));
- - text: wordBlanks should contain all of the words assigned to the variables myNoun, myVerb, myAdjective and myAdverb separated by non-word characters (and any additional words in your madlib).
- testString: assert(/\bdog\b/.test(wordBlanks) && /\bbig\b/.test(wordBlanks) && /\bran\b/.test(wordBlanks) && /\bquickly\b/.test(wordBlanks));
+`wordBlanks` should be a string.
+```js
+assert(typeof wordBlanks === 'string');
```
-
+You should not change the values assigned to `myNoun`, `myVerb`, `myAdjective` or `myAdverb`.
-## Challenge Seed
-
+```js
+assert(
+ myNoun === 'dog' &&
+ myVerb === 'ran' &&
+ myAdjective === 'big' &&
+ myAdverb === 'quickly'
+);
+```
-
+You should not directly use the values "dog", "ran", "big", or "quickly" to create `wordBlanks`.
+
+```js
+const newCode = removeAssignments(code);
+assert(
+ !/dog/.test(newCode) &&
+ !/ran/.test(newCode) &&
+ !/big/.test(newCode) &&
+ !/quickly/.test(newCode)
+);
+```
+
+`wordBlanks` should contain all of the words assigned to the variables `myNoun`, `myVerb`, `myAdjective` and `myAdverb` separated by non-word characters (and any additional words in your madlib).
+
+```js
+assert(
+ /\bdog\b/.test(wordBlanks) &&
+ /\bbig\b/.test(wordBlanks) &&
+ /\bran\b/.test(wordBlanks) &&
+ /\bquickly\b/.test(wordBlanks)
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+const removeAssignments = str => str
+ .replace(/myNoun\s*=\s*["']dog["']/g, '')
+ .replace(/myAdjective\s*=\s*["']big["']/g, '')
+ .replace(/myVerb\s*=\s*["']ran["']/g, '')
+ .replace(/myAdverb\s*=\s*["']quickly["']/g, '');
+```
+
+## --seed-contents--
```js
var myNoun = "dog";
@@ -59,25 +93,7 @@ var wordBlanks = ""; // Change this line
// Only change code above this line
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var myNoun = "dog";
@@ -88,5 +104,3 @@ var myAdverb = "quickly";
var wordBlanks = "Once there was a " + myNoun + " which was very " + myAdjective + ". ";
wordBlanks += "It " + myVerb + " " + myAdverb + " around the yard.";
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md
index 1128e6584e..7b7de2b156 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md
@@ -6,9 +6,10 @@ videoUrl: 'https://scrimba.com/c/cL6dqfy'
forumTopicId: 18378
---
-## Description
-
+# --description--
+
In JavaScript, we can divide up our code into reusable parts called functions.
+
Here's an example of a function:
```js
@@ -17,47 +18,35 @@ function functionName() {
}
```
-You can call or invoke this function by using its name followed by parentheses, like this:
-functionName();
-Each time the function is called it will print out the message "Hello World" on the dev console. All of the code between the curly braces will be executed every time the function is called.
-
+You can call or invoke this function by using its name followed by parentheses, like this: `functionName();` Each time the function is called it will print out the message `"Hello World"` on the dev console. All of the code between the curly braces will be executed every time the function is called.
+
+# --instructions--
-## Instructions
-
Create a function called reusableFunction which prints "Hi World" to the dev console.
Call the function.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: reusableFunction should be a function.
- testString: assert(typeof reusableFunction === 'function');
- - text: reusableFunction should output "Hi World" to the dev console.
- testString: assert(hiWorldWasLogged);
- - text: You should call reusableFunction after you define it.
- testString: assert(/^\s*reusableFunction\(\)\s*/m.test(code));
-
-```
-
-
-
-## Challenge Seed
-
-
-
+`reusableFunction` should be a function.
```js
-
-
-
+assert(typeof reusableFunction === 'function');
```
-
+`reusableFunction` should output "Hi World" to the dev console.
-### Before Test
-
+```js
+assert(hiWorldWasLogged);
+```
+
+You should call `reusableFunction` after you define it.
+
+```js
+assert(/^\s*reusableFunction\(\)\s*/m.test(code));
+```
+
+# --seed--
+
+## --before-user-code--
```js
var logOutput = "";
@@ -84,10 +73,7 @@ function uncapture() {
capture();
```
-
+## --seed-contents--
-
-
-## Solution
-
+```js
+```
+# --solutions--
```js
function reusableFunction() {
@@ -113,5 +98,3 @@ function reusableFunction() {
}
reusableFunction();
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md
index e83571e6e1..d6bccb7c97 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md
@@ -5,34 +5,31 @@ challengeType: 1
forumTopicId: 301184
---
-## Description
-
+# --description--
+
Continuing the discussion on calling functions, the next bug to watch out for is when a function's arguments are supplied in the incorrect order. If the arguments are different types, such as a function expecting an array and an integer, this will likely throw a runtime error. If the arguments are the same type (all integers, for example), then the logic of the code won't make sense. Make sure to supply all required arguments, in the proper order to avoid these issues.
-
-## Instructions
-
-The function raiseToPower raises a base to an exponent. Unfortunately, it's not called properly - fix the code so the value of power is the expected 8.
-
+# --instructions--
-## Tests
-
+The function `raiseToPower` raises a base to an exponent. Unfortunately, it's not called properly - fix the code so the value of `power` is the expected 8.
-```yml
-tests:
- - text: Your code should fix the variable power so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.
- testString: assert(power == 8);
- - text: Your code should use the correct order of the arguments for the raiseToPower function call.
- testString: assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g));
+# --hints--
+Your code should fix the variable `power` so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.
+
+```js
+assert(power == 8);
```
-
+Your code should use the correct order of the arguments for the `raiseToPower` function call.
-## Challenge Seed
-
+```js
+assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g));
+```
-
+# --seed--
+
+## --seed-contents--
```js
function raiseToPower(b, e) {
@@ -45,14 +42,7 @@ let power = raiseToPower(exp, base);
console.log(power);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function raiseToPower(b, e) {
@@ -64,5 +54,3 @@ let exp = 3;
let power = raiseToPower(base, exp);
console.log(power);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md
index 67d02564da..33ad2aeef9 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 301185
---
-## Description
-
+# --description--
+
When a function or method doesn't take any arguments, you may forget to include the (empty) opening and closing parentheses when calling it. Often times the result of a function call is saved in a variable for other use in your code. This error can be detected by logging variable values (or their types) to the console and seeing that one is set to a function reference, instead of the expected value the function returns.
+
The variables in the following example are different:
```js
@@ -18,31 +19,27 @@ let varOne = myFunction; // set to equal a function
let varTwo = myFunction(); // set to equal the string "You rock!"
```
-
+# --instructions--
-## Instructions
-
-Fix the code so the variable result is set to the value returned from calling the function getNine.
-
+Fix the code so the variable `result` is set to the value returned from calling the function `getNine`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should fix the variable result so it is set to the number that the function getNine returns.
- testString: assert(result == 9);
- - text: Your code should call the getNine function.
- testString: assert(code.match(/getNine\(\)/g).length == 2);
+Your code should fix the variable `result` so it is set to the number that the function `getNine` returns.
+```js
+assert(result == 9);
```
-
+Your code should call the `getNine` function.
-## Challenge Seed
-
+```js
+assert(code.match(/getNine\(\)/g).length == 2);
+```
-
+# --seed--
+
+## --seed-contents--
```js
function getNine() {
@@ -55,14 +52,7 @@ let result = getNine;
console.log(result);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function getNine() {
@@ -74,5 +64,3 @@ function getNine() {
let result = getNine();
console.log(result);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md
index 11518d592e..3479e17dd2 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md
@@ -5,41 +5,51 @@ challengeType: 1
forumTopicId: 301186
---
-## Description
-
-The console.log() and typeof methods are the two primary ways to check intermediate values and types of program output. Now it's time to get into the common forms that bugs take. One syntax-level issue that fast typers can commiserate with is the humble spelling error.
+# --description--
+
+The `console.log()` and `typeof` methods are the two primary ways to check intermediate values and types of program output. Now it's time to get into the common forms that bugs take. One syntax-level issue that fast typers can commiserate with is the humble spelling error.
+
Transposed, missing, or mis-capitalized characters in a variable or function name will have the browser looking for an object that doesn't exist - and complain in the form of a reference error. JavaScript variable and function names are case-sensitive.
-
-## Instructions
-
-Fix the two spelling errors in the code so the netWorkingCapital calculation works.
-
+# --instructions--
-## Tests
-
+Fix the two spelling errors in the code so the `netWorkingCapital` calculation works.
-```yml
-tests:
- - text: 'Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2".'
- testString: 'assert(netWorkingCapital === 2);'
- - text: There should be no instances of mis-spelled variables in the code.
- testString: assert(!code.match(/recievables/g));
- - text: The receivables variable should be declared and used properly in the code.
- testString: assert(code.match(/receivables/g).length == 2);
- - text: There should be no instances of mis-spelled variables in the code.
- testString: assert(!code.match(/payable;/g));
- - text: The payables variable should be declared and used properly in the code.
- testString: assert(code.match(/payables/g).length == 2);
+# --hints--
+Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2".
+
+```js
+assert(netWorkingCapital === 2);
```
-
+There should be no instances of mis-spelled variables in the code.
-## Challenge Seed
-
+```js
+assert(!code.match(/recievables/g));
+```
-
+The `receivables` variable should be declared and used properly in the code.
+
+```js
+assert(code.match(/receivables/g).length == 2);
+```
+
+There should be no instances of mis-spelled variables in the code.
+
+```js
+assert(!code.match(/payable;/g));
+```
+
+The `payables` variable should be declared and used properly in the code.
+
+```js
+assert(code.match(/payables/g).length == 2);
+```
+
+# --seed--
+
+## --seed-contents--
```js
let receivables = 10;
@@ -48,14 +58,7 @@ let netWorkingCapital = recievables - payable;
console.log(`Net working capital is: ${netWorkingCapital}`);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
let receivables = 10;
@@ -63,5 +66,3 @@ let payables = 8;
let netWorkingCapital = receivables - payables;
console.log(`Net working capital is: ${netWorkingCapital}`);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md
index 4732000573..4676522875 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md
@@ -5,10 +5,12 @@ challengeType: 1
forumTopicId: 301188
---
-## Description
-
-JavaScript allows the use of both single (') and double (") quotes to declare a string. Deciding which one to use generally comes down to personal preference, with some exceptions.
+# --description--
+
+JavaScript allows the use of both single (`'`) and double (`"`) quotes to declare a string. Deciding which one to use generally comes down to personal preference, with some exceptions.
+
Having two choices is great when a string has contractions or another piece of text that's in quotes. Just be careful that you don't close the string too early, which causes a syntax error.
+
Here are some examples of mixing quotes:
```js
@@ -19,56 +21,43 @@ const quoteInString = "Groucho Marx once said 'Quote me as saying I was mis-quot
const uhOhGroucho = 'I've had a perfectly wonderful evening, but this wasn't it.';
```
-Of course, it is okay to use only one style of quotes. You can escape the quotes inside the string by using the backslash (\\) escape character:
+Of course, it is okay to use only one style of quotes. You can escape the quotes inside the string by using the backslash (`\`) escape character:
```js
// Correct use of same quotes:
const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t it.';
```
-
+# --instructions--
-## Instructions
-
-Fix the string so it either uses different quotes for the href value, or escape the existing ones. Keep the double quote marks around the entire string.
-
+Fix the string so it either uses different quotes for the `href` value, or escape the existing ones. Keep the double quote marks around the entire string.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should fix the quotes around the href value "#Home" by either changing or escaping them.
- testString: assert(code.match(//g));
- - text: Your code should keep the double quotes around the entire string.
- testString: assert(code.match(/"
";
console.log(innerHtml);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md
index 2a3ef9d968..bbd5cdafa0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 301189
---
-## Description
-
-Off by one errors (sometimes called OBOE) crop up when you're trying to target a specific index of a string or array (to slice or access a segment), or when looping over the indices of them. JavaScript indexing starts at zero, not one, which means the last index is always one less than the length of the item. If you try to access an index equal to the length, the program may throw an "index out of range" reference error or print undefined.
+# --description--
+
+Off by one errors (sometimes called OBOE) crop up when you're trying to target a specific index of a string or array (to slice or access a segment), or when looping over the indices of them. JavaScript indexing starts at zero, not one, which means the last index is always one less than the length of the item. If you try to access an index equal to the length, the program may throw an "index out of range" reference error or print `undefined`.
+
When you use string or array methods that take index ranges as arguments, it helps to read the documentation and understand if they are inclusive (the item at the given index is part of what's returned) or not. Here are some examples of off by one errors:
```js
@@ -27,35 +28,39 @@ for (let k = 0; k < len; k++) {
}
```
-
+# --instructions--
-## Instructions
-
Fix the two indexing errors in the following function so all the numbers 1 through 5 are printed to the console.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should set the initial condition of the loop so it starts at the first index.
- testString: assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1);
- - text: Your code should fix the initial condition of the loop so that the index starts at 0.
- testString: assert(!code.match(/i\s?=\s*?1\s*?;/g));
- - text: Your code should set the terminal condition of the loop so it stops at the last index.
- testString: assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1);
- - text: Your code should fix the terminal condition of the loop so that it stops at 1 before the length.
- testString: assert(!code.match(/i\s*?<=\s*?len;/g));
+Your code should set the initial condition of the loop so it starts at the first index.
+```js
+assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1);
```
-
+Your code should fix the initial condition of the loop so that the index starts at 0.
-## Challenge Seed
-
+```js
+assert(!code.match(/i\s?=\s*?1\s*?;/g));
+```
-
+Your code should set the terminal condition of the loop so it stops at the last index.
+
+```js
+assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1);
+```
+
+Your code should fix the terminal condition of the loop so that it stops at 1 before the length.
+
+```js
+assert(!code.match(/i\s*?<=\s*?len;/g));
+```
+
+# --seed--
+
+## --seed-contents--
```js
function countToFive() {
@@ -71,14 +76,7 @@ function countToFive() {
countToFive();
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function countToFive() {
@@ -93,5 +91,3 @@ function countToFive() {
countToFive();
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md
index 49ea32f7ab..f1eb09e29e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md
@@ -5,35 +5,33 @@ challengeType: 1
forumTopicId: 301190
---
-## Description
-
+# --description--
+
Another syntax error to be aware of is that all opening parentheses, brackets, curly braces, and quotes have a closing pair. Forgetting a piece tends to happen when you're editing existing code and inserting items with one of the pair types. Also, take care when nesting code blocks into others, such as adding a callback function as an argument to a method.
+
One way to avoid this mistake is as soon as the opening character is typed, immediately include the closing match, then move the cursor back between them and continue coding. Fortunately, most modern code editors generate the second half of the pair automatically.
-
-## Instructions
-
+# --instructions--
+
Fix the two pair errors in the code.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should fix the missing piece of the array.
- testString: assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g));
- - text: 'Your code should fix the missing piece of the .reduce() method. The console output should show that "Sum of array values is: 6".'
- testString: 'assert(arraySum === 6);'
+Your code should fix the missing piece of the array.
+```js
+assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g));
```
-
+Your code should fix the missing piece of the `.reduce()` method. The console output should show that "Sum of array values is: 6".
-## Challenge Seed
-
+```js
+assert(arraySum === 6);
+```
-
+# --seed--
+
+## --seed-contents--
```js
let myArray = [1, 2, 3;
@@ -41,19 +39,10 @@ let arraySum = myArray.reduce((previous, current => previous + current);
console.log(`Sum of array values is: ${arraySum}`);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
let myArray = [1, 2, 3];
let arraySum = myArray.reduce((previous, current) => previous + current);
console.log(`Sum of array values is: ${arraySum}`);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md
index 8d0435e6b0..2baeca537a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md
@@ -5,12 +5,15 @@ challengeType: 1
forumTopicId: 301191
---
-## Description
-
-Branching programs, i.e. ones that do different things if certain conditions are met, rely on if, else if, and else statements in JavaScript. The condition sometimes takes the form of testing whether a result is equal to a value.
-This logic is spoken (in English, at least) as "if x equals y, then ..." which can literally translate into code using the =, or assignment operator. This leads to unexpected control flow in your program.
-As covered in previous challenges, the assignment operator (=) in JavaScript assigns a value to a variable name. And the == and === operators check for equality (the triple === tests for strict equality, meaning both value and type are the same).
-The code below assigns x to be 2, which evaluates as true. Almost every value on its own in JavaScript evaluates to true, except what are known as the "falsy" values: false, 0, "" (an empty string), NaN, undefined, and null.
+# --description--
+
+Branching programs, i.e. ones that do different things if certain conditions are met, rely on `if`, `else if`, and `else` statements in JavaScript. The condition sometimes takes the form of testing whether a result is equal to a value.
+
+This logic is spoken (in English, at least) as "if x equals y, then ..." which can literally translate into code using the `=`, or assignment operator. This leads to unexpected control flow in your program.
+
+As covered in previous challenges, the assignment operator (`=`) in JavaScript assigns a value to a variable name. And the `==` and `===` operators check for equality (the triple `===` tests for strict equality, meaning both value and type are the same).
+
+The code below assigns `x` to be 2, which evaluates as `true`. Almost every value on its own in JavaScript evaluates to `true`, except what are known as the "falsy" values: `false`, `0`, `""` (an empty string), `NaN`, `undefined`, and `null`.
```js
let x = 1;
@@ -22,31 +25,27 @@ if (x = y) {
}
```
-
+# --instructions--
-## Instructions
-
-Fix the condition so the program runs the right branch, and the appropriate value is assigned to result.
-
+Fix the condition so the program runs the right branch, and the appropriate value is assigned to `result`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should fix the condition so it checks for equality, instead of using assignment.
- testString: assert(result == "Not equal!");
- - text: The condition should use either == or === to test for equality.
- testString: assert(code.match(/x\s*?===?\s*?y/g));
+Your code should fix the condition so it checks for equality, instead of using assignment.
+```js
+assert(result == 'Not equal!');
```
-
+The condition should use either `==` or `===` to test for equality.
-## Challenge Seed
-
+```js
+assert(code.match(/x\s*?===?\s*?y/g));
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
let x = 7;
@@ -84,5 +76,3 @@ if(x === y) {
console.log(result);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md
index 3a95b7fc52..a859d6c7f8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md
@@ -5,10 +5,11 @@ challengeType: 1
forumTopicId: 301192
---
-## Description
-
+# --description--
+
The final topic is the dreaded infinite loop. Loops are great tools when you need your program to run a code block a certain number of times or until a condition is met, but they need a terminal condition that ends the looping. Infinite loops are likely to freeze or crash the browser, and cause general program execution mayhem, which no one wants.
-There was an example of an infinite loop in the introduction to this section - it had no terminal condition to break out of the while loop inside loopy(). Do NOT call this function!
+
+There was an example of an infinite loop in the introduction to this section - it had no terminal condition to break out of the `while` loop inside `loopy()`. Do NOT call this function!
```js
function loopy() {
@@ -19,31 +20,28 @@ function loopy() {
```
It's the programmer's job to ensure that the terminal condition, which tells the program when to break out of the loop code, is eventually reached. One error is incrementing or decrementing a counter variable in the wrong direction from the terminal condition. Another one is accidentally resetting a counter or index variable within the loop code, instead of incrementing or decrementing it.
-
-## Instructions
-
-The myFunc() function contains an infinite loop because the terminal condition i != 4 will never evaluate to false (and break the looping) - i will increment by 2 each pass, and jump right over 4 since i is odd to start. Fix the comparison operator in the terminal condition so the loop only runs for i less than or equal to 4.
-
+# --instructions--
-## Tests
-
+The `myFunc()` function contains an infinite loop because the terminal condition `i != 4` will never evaluate to `false` (and break the looping) - `i` will increment by 2 each pass, and jump right over 4 since `i` is odd to start. Fix the comparison operator in the terminal condition so the loop only runs for `i` less than or equal to 4.
-```yml
-tests:
- - text: Your code should change the comparison operator in the terminal condition (the middle part) of the for loop.
- testString: assert(code.match(/i\s*?<=\s*?4;/g).length == 1);
- - text: Your code should fix the comparison operator in the terminal condition of the loop.
- testString: assert(!code.match(/i\s*?!=\s*?4;/g));
+# --hints--
+Your code should change the comparison operator in the terminal condition (the middle part) of the `for` loop.
+
+```js
+assert(code.match(/i\s*?<=\s*?4;/g).length == 1);
```
-
+Your code should fix the comparison operator in the terminal condition of the loop.
-## Challenge Seed
-
+```js
+assert(!code.match(/i\s*?!=\s*?4;/g));
+```
-
+# --seed--
+
+## --seed-contents--
```js
function myFunc() {
@@ -53,14 +51,7 @@ function myFunc() {
}
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function myFunc() {
@@ -69,5 +60,3 @@ function myFunc() {
}
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md
index 6e9dc56b6d..c282cd45ed 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md
@@ -5,41 +5,47 @@ challengeType: 1
forumTopicId: 301193
---
-## Description
-
+# --description--
+
You may have noticed that some freeCodeCamp JavaScript challenges include their own console. This console behaves a little differently than the browser console you used in the last challenge.
+
The following challenge is meant to highlight the main difference between the freeCodeCamp console and your browser console.
-When you run ordinary JavaScript, the browser's console will display your console.log() statements the exact number of times it is called.
-The freeCodeCamp console will print your console.log() statements a short time after the editor detects a change in the script, as well as during testing.
+
+When you run ordinary JavaScript, the browser's console will display your `console.log()` statements the exact number of times it is called.
+
+The freeCodeCamp console will print your `console.log()` statements a short time after the editor detects a change in the script, as well as during testing.
+
The freeCodeCamp console is cleared before the tests are run and, to avoid spam, only prints the logs during the first test (see the note below for exceptions).
-If you would like to see every log for every test, run the tests, and open the browser console. If you prefer to use the browser console, and want it to mimic the freeCodeCamp console, place console.clear() before any other console calls, to clear the browser console.
+
+If you would like to see every log for every test, run the tests, and open the browser console. If you prefer to use the browser console, and want it to mimic the freeCodeCamp console, place `console.clear()` before any other `console` calls, to clear the browser console.
**Note:** `console.log`s inside functions are printed to the freeCodeCamp console whenever those functions are called, this can help debugging functions that are called during testing.
-
-## Instructions
-
-First, use console.log to log the output variable. Then, use console.clear to clear the browser console.
-
+# --instructions--
-## Tests
-
+First, use `console.log` to log the `output` variable. Then, use `console.clear` to clear the browser console.
-```yml
-tests:
- - text: You should use console.clear() to clear the browser console.
- testString: assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console.clear\(\)/));
- - text: You should use console.log() to print the output variable.
- testString: assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));
+# --hints--
+You should use `console.clear()` to clear the browser console.
+
+```js
+assert(
+ __helpers
+ .removeWhiteSpace(__helpers.removeJSComments(code))
+ .match(/console.clear\(\)/)
+);
```
-
+You should use `console.log()` to print the `output` variable.
-## Challenge Seed
-
+```js
+assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));
+```
-
+# --seed--
+
+## --seed-contents--
```js
// Open your browser console.
@@ -51,13 +57,7 @@ let output = "Get this to log once in the freeCodeCamp console and twice in the
// Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
// Open your browser console.
@@ -70,5 +70,3 @@ console.log(output);
// Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md
index c3667519a9..70cb60863e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.md
@@ -5,37 +5,41 @@ challengeType: 1
forumTopicId: 301194
---
-## Description
-
+# --description--
+
Sometimes it's necessary to save information, increment counters, or re-set variables within a loop. A potential issue is when variables either should be reinitialized, and aren't, or vice versa. This is particularly dangerous if you accidentally reset the variable being used for the terminal condition, causing an infinite loop.
-Printing variable values with each cycle of your loop by using console.log() can uncover buggy behavior related to resetting, or failing to reset a variable.
-
-## Instructions
-
-The following function is supposed to create a two-dimensional array with m rows and n columns of zeroes. Unfortunately, it's not producing the expected output because the row variable isn't being reinitialized (set back to an empty array) in the outer loop. Fix the code so it returns a correct 3x2 array of zeroes, which looks like [[0, 0], [0, 0], [0, 0]].
-
+Printing variable values with each cycle of your loop by using `console.log()` can uncover buggy behavior related to resetting, or failing to reset a variable.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should set the matrix variable to an array holding 3 rows of 2 columns of zeroes each.
- testString: assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]");
- - text: The matrix variable should have 3 rows.
- testString: assert(matrix.length == 3);
- - text: The matrix variable should have 2 columns in each row.
- testString: assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2);
+The following function is supposed to create a two-dimensional array with `m` rows and `n` columns of zeroes. Unfortunately, it's not producing the expected output because the `row` variable isn't being reinitialized (set back to an empty array) in the outer loop. Fix the code so it returns a correct 3x2 array of zeroes, which looks like `[[0, 0], [0, 0], [0, 0]]`.
+# --hints--
+
+Your code should set the `matrix` variable to an array holding 3 rows of 2 columns of zeroes each.
+
+```js
+assert(JSON.stringify(matrix) == '[[0,0],[0,0],[0,0]]');
```
-
+The `matrix` variable should have 3 rows.
-## Challenge Seed
-
+```js
+assert(matrix.length == 3);
+```
-
+The `matrix` variable should have 2 columns in each row.
+
+```js
+assert(
+ matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function zeroArray(m, n) {
@@ -59,14 +63,7 @@ let matrix = zeroArray(3, 2);
console.log(matrix);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function zeroArray(m, n) {
@@ -89,5 +86,3 @@ function zeroArray(m, n) {
let matrix = zeroArray(3, 2);
console.log(matrix);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md
index 4a72d21d74..50318cb098 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md
@@ -5,36 +5,33 @@ challengeType: 1
forumTopicId: 18372
---
-## Description
-
+# --description--
+
Both Chrome and Firefox have excellent JavaScript consoles, also known as DevTools, for debugging your JavaScript.
+
You can find Developer tools in your Chrome's menu or Web Console in Firefox's menu. If you're using a different browser, or a mobile phone, we strongly recommend switching to desktop Firefox or Chrome.
-The console.log() method, which "prints" the output of what's within its parentheses to the console, will likely be the most helpful debugging tool. Placing it at strategic points in your code can show you the intermediate values of variables. It's good practice to have an idea of what the output should be before looking at what it is. Having check points to see the status of your calculations throughout your code will help narrow down where the problem is.
+
+The `console.log()` method, which "prints" the output of what's within its parentheses to the console, will likely be the most helpful debugging tool. Placing it at strategic points in your code can show you the intermediate values of variables. It's good practice to have an idea of what the output should be before looking at what it is. Having check points to see the status of your calculations throughout your code will help narrow down where the problem is.
+
Here's an example to print 'Hello world!' to the console:
-console.log('Hello world!');
-
-## Instructions
-
-Use the console.log() method to print the value of the variable a where noted in the code.
-
+`console.log('Hello world!');`
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should use console.log() to check the value of the variable a.
- testString: assert(code.match(/console\.log\(a\)/g));
+Use the `console.log()` method to print the value of the variable `a` where noted in the code.
+# --hints--
+
+Your code should use `console.log()` to check the value of the variable `a`.
+
+```js
+assert(code.match(/console\.log\(a\)/g));
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```js
let a = 5;
@@ -47,18 +44,8 @@ let sumAB = a + b;
console.log(sumAB);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var a = 5; console.log(a);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md
index 25497f96f7..eddddd078f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md
@@ -5,10 +5,11 @@ challengeType: 1
forumTopicId: 18374
---
-## Description
-
-You can use typeof to check the data structure, or type, of a variable. This is useful in debugging when working with multiple data types. If you think you're adding two numbers, but one is actually a string, the results can be unexpected. Type errors can lurk in calculations or function calls. Be careful especially when you're accessing and working with external data in the form of a JavaScript Object Notation (JSON) object.
-Here are some examples using typeof:
+# --description--
+
+You can use `typeof` to check the data structure, or type, of a variable. This is useful in debugging when working with multiple data types. If you think you're adding two numbers, but one is actually a string, the results can be unexpected. Type errors can lurk in calculations or function calls. Be careful especially when you're accessing and working with external data in the form of a JavaScript Object Notation (JSON) object.
+
+Here are some examples using `typeof`:
```js
console.log(typeof ""); // outputs "string"
@@ -17,56 +18,46 @@ console.log(typeof []); // outputs "object"
console.log(typeof {}); // outputs "object"
```
-JavaScript recognizes six primitive (immutable) data types: Boolean, Null, Undefined, Number, String, and Symbol (new with ES6) and one type for mutable items: Object. Note that in JavaScript, arrays are technically a type of object.
-
+JavaScript recognizes six primitive (immutable) data types: `Boolean`, `Null`, `Undefined`, `Number`, `String`, and `Symbol` (new with ES6) and one type for mutable items: `Object`. Note that in JavaScript, arrays are technically a type of object.
-## Instructions
-
-Add two console.log() statements to check the typeof each of the two variables seven and three in the code.
-
+# --instructions--
-## Tests
-
+Add two `console.log()` statements to check the `typeof` each of the two variables `seven` and `three` in the code.
-```yml
-tests:
- - text: Your code should use typeof in two console.log() statements to check the type of the variables.
- testString: assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2);
- - text: Your code should use typeof to check the type of the variable seven.
- testString: assert(code.match(/typeof[\( ]seven\)?/g));
- - text: Your code should use typeof to check the type of the variable three.
- testString: assert(code.match(/typeof[\( ]three\)?/g));
+# --hints--
+Your code should use `typeof` in two `console.log()` statements to check the type of the variables.
+
+```js
+assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2);
```
-
+Your code should use `typeof` to check the type of the variable `seven`.
-## Challenge Seed
-
+```js
+assert(code.match(/typeof[\( ]seven\)?/g));
+```
-
+Your code should use `typeof` to check the type of the variable `three`.
+
+```js
+assert(code.match(/typeof[\( ]three\)?/g));
+```
+
+# --seed--
+
+## --seed-contents--
```js
let seven = 7;
let three = "3";
console.log(seven + three);
// Only change code below this line
-
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
let seven = 7;let three = "3";console.log(typeof seven);
console.log(typeof three);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md
index 5cb7c08f20..c137e6a349 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md
@@ -5,10 +5,12 @@ challengeType: 1
forumTopicId: 301195
---
-## Description
-
-When you declare a variable with the var keyword, it is declared globally, or locally if declared inside a function.
-The let keyword behaves similarly, but with some extra features. When you declare a variable with the let keyword inside a block, statement, or expression, its scope is limited to that block, statement, or expression.
+# --description--
+
+When you declare a variable with the `var` keyword, it is declared globally, or locally if declared inside a function.
+
+The `let` keyword behaves similarly, but with some extra features. When you declare a variable with the `let` keyword inside a block, statement, or expression, its scope is limited to that block, statement, or expression.
+
For example:
```js
@@ -22,7 +24,7 @@ console.log(i);
// returns 3
```
-With the var keyword, i is declared globally. So when i++ is executed, it updates the global variable. This code is similar to the following:
+With the `var` keyword, `i` is declared globally. So when `i++` is executed, it updates the global variable. This code is similar to the following:
```js
var numArray = [];
@@ -36,7 +38,7 @@ console.log(i);
// returns 3
```
-This behavior will cause problems if you were to create a function and store it for later use inside a for loop that uses the i variable. This is because the stored function will always refer to the value of the updated global i variable.
+This behavior will cause problems if you were to create a function and store it for later use inside a for loop that uses the `i` variable. This is because the stored function will always refer to the value of the updated global `i` variable.
```js
var printNumTwo;
@@ -51,7 +53,7 @@ console.log(printNumTwo());
// returns 3
```
-As you can see, printNumTwo() prints 3 and not 2. This is because the value assigned to i was updated and the printNumTwo() returns the global i and not the value i had when the function was created in the for loop. The let keyword does not follow this behavior:
+As you can see, `printNumTwo()` prints 3 and not 2. This is because the value assigned to `i` was updated and the `printNumTwo()` returns the global `i` and not the value `i` had when the function was created in the for loop. The `let` keyword does not follow this behavior:
```js
let printNumTwo;
@@ -68,35 +70,40 @@ console.log(i);
// returns "i is not defined"
```
-i is not defined because it was not declared in the global scope. It is only declared within the for loop statement. printNumTwo() returned the correct value because three different i variables with unique values (0, 1, and 2) were created by the let keyword within the loop statement.
-
+`i` is not defined because it was not declared in the global scope. It is only declared within the for loop statement. `printNumTwo()` returned the correct value because three different `i` variables with unique values (0, 1, and 2) were created by the `let` keyword within the loop statement.
-## Instructions
-
-Fix the code so that i declared in the if statement is a separate variable than i declared in the first line of the function. Be certain not to use the var keyword anywhere in your code.
-This exercise is designed to illustrate the difference between how var and let keywords assign scope to the declared variable. When programming a function similar to the one used in this exercise, it is often better to use different variable names to avoid confusion.
-
+# --instructions--
-## Tests
-
+Fix the code so that `i` declared in the if statement is a separate variable than `i` declared in the first line of the function. Be certain not to use the `var` keyword anywhere in your code.
-```yml
-tests:
- - text: var should not exist in code.
- testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- - text: The variable i declared in the if statement should equal "block scope".
- testString: getUserInput => assert(getUserInput('index').match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g));
- - text: checkScope() should return "function scope"
- testString: assert(checkScope() === "function scope");
+This exercise is designed to illustrate the difference between how `var` and `let` keywords assign scope to the declared variable. When programming a function similar to the one used in this exercise, it is often better to use different variable names to avoid confusion.
+# --hints--
+
+`var` should not exist in code.
+
+```js
+(getUserInput) => assert(!getUserInput('index').match(/var/g));
```
-
+The variable `i` declared in the if statement should equal "block scope".
-## Challenge Seed
-
+```js
+(getUserInput) =>
+ assert(
+ getUserInput('index').match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)
+ );
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function checkScope() {
@@ -131,5 +131,3 @@ function checkScope() {
return i;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md
index b67a808b1e..adb9f2d80b 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md
@@ -5,9 +5,9 @@ challengeType: 1
forumTopicId: 301196
---
-## Description
-
-A promise has three states: pending, fulfilled, and rejected. The promise you created in the last challenge is forever stuck in the pending state because you did not add a way to complete the promise. The resolve and reject parameters given to the promise argument are used to do this. resolve is used when you want your promise to succeed, and reject is used when you want it to fail. These are methods that take an argument, as seen below.
+# --description--
+
+A promise has three states: `pending`, `fulfilled`, and `rejected`. The promise you created in the last challenge is forever stuck in the `pending` state because you did not add a way to complete the promise. The `resolve` and `reject` parameters given to the promise argument are used to do this. `resolve` is used when you want your promise to succeed, and `reject` is used when you want it to fail. These are methods that take an argument, as seen below.
```js
const myPromise = new Promise((resolve, reject) => {
@@ -20,50 +20,55 @@ const myPromise = new Promise((resolve, reject) => {
```
The example above uses strings for the argument of these functions, but it can really be anything. Often, it might be an object, that you would use data from, to put on your website or elsewhere.
-
-## Instructions
-
-Make the promise handle success and failure. If responseFromServer is true, call the resolve method to successfully complete the promise. Pass resolve a string with the value We got the data. If responseFromServer is false, use the reject method instead and pass it the string: Data not received.
-
+# --instructions--
-## Tests
-
+Make the promise handle success and failure. If `responseFromServer` is `true`, call the `resolve` method to successfully complete the promise. Pass `resolve` a string with the value `We got the data`. If `responseFromServer` is `false`, use the `reject` method instead and pass it the string: `Data not received`.
-```yml
-tests:
- - text: resolve should be called with the expected string when the if condition is true.
- testString: assert(__helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g));
- - text: reject should be called with the expected string when the if condition is false.
- testString: assert(__helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g));
+# --hints--
+`resolve` should be called with the expected string when the `if` condition is `true`.
+
+```js
+assert(
+ __helpers
+ .removeJSComments(code)
+ .match(
+ /if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g
+ )
+);
```
-
+`reject` should be called with the expected string when the `if` condition is `false`.
-## Challenge Seed
-
-
+```js
+assert(
+ __helpers
+ .removeJSComments(code)
+ .match(
+ /}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g
+ )
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer represents a response from a server
let responseFromServer;
-
+
if(responseFromServer) {
// Change this line
- } else {
+ } else {
// Change this line
}
});
```
-
-
-
-
-## Solution
-
+# --solutions--
```js
const makeServerRequest = new Promise((resolve, reject) => {
@@ -72,10 +77,8 @@ const makeServerRequest = new Promise((resolve, reject) => {
if(responseFromServer) {
resolve("We got the data");
- } else {
+ } else {
reject("Data not received");
}
});
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md
index 2064404147..3ebbcc41fc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md
@@ -5,9 +5,9 @@ challengeType: 1
forumTopicId: 301197
---
-## Description
-
-A promise in JavaScript is exactly what it sounds like - you use it to make a promise to do something, usually asynchronously. When the task completes, you either fulfill your promise or fail to do so. Promise is a constructor function, so you need to use the new keyword to create one. It takes a function, as its argument, with two parameters - resolve and reject. These are methods used to determine the outcome of the promise. The syntax looks like this:
+# --description--
+
+A promise in JavaScript is exactly what it sounds like - you use it to make a promise to do something, usually asynchronously. When the task completes, you either fulfill your promise or fail to do so. `Promise` is a constructor function, so you need to use the `new` keyword to create one. It takes a function, as its argument, with two parameters - `resolve` and `reject`. These are methods used to determine the outcome of the promise. The syntax looks like this:
```js
const myPromise = new Promise((resolve, reject) => {
@@ -15,44 +15,39 @@ const myPromise = new Promise((resolve, reject) => {
});
```
-
+# --instructions--
-## Instructions
-
-Create a new promise called makeServerRequest. Pass in a function with resolve and reject parameters to the constructor.
-
+Create a new promise called `makeServerRequest`. Pass in a function with `resolve` and `reject` parameters to the constructor.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should assign a promise to a declared variable named makeServerRequest.
- testString: assert(makeServerRequest instanceof Promise);
- - text: Your promise should receive a function with resolve and reject as parameters.
- testString: assert(code.match(/Promise\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g));
-```
-
-
-
-## Challenge Seed
-
-
+You should assign a promise to a declared variable named `makeServerRequest`.
```js
-
+assert(makeServerRequest instanceof Promise);
```
-
-
+Your promise should receive a function with `resolve` and `reject` as parameters.
-## Solution
-
+```js
+assert(
+ code.match(
+ /Promise\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g
+ )
+);
+```
+
+# --seed--
+
+## --seed-contents--
+
+```js
+```
+
+# --solutions--
```js
const makeServerRequest = new Promise((resolve, reject) => {
});
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md
index 6f16307c67..5ba95f4484 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md
@@ -5,40 +5,51 @@ challengeType: 6
forumTopicId: 301198
---
-## Description
-
-JavaScript started with a small role to play on an otherwise mostly HTML web. Today, it’s huge, and some websites are built almost entirely with JavaScript. In order to make JavaScript more modular, clean, and maintainable; ES6 introduced a way to easily share code among JavaScript files. This involves exporting parts of a file for use in one or more other files, and importing the parts you need, where you need them. In order to take advantage of this functionality, you need to create a script in your HTML document with a type of module. Here’s an example:
+# --description--
+
+JavaScript started with a small role to play on an otherwise mostly HTML web. Today, it’s huge, and some websites are built almost entirely with JavaScript. In order to make JavaScript more modular, clean, and maintainable; ES6 introduced a way to easily share code among JavaScript files. This involves exporting parts of a file for use in one or more other files, and importing the parts you need, where you need them. In order to take advantage of this functionality, you need to create a script in your HTML document with a type of `module`. Here’s an example:
```html
```
-A script that uses this module type can now use the import and export features you will learn about in the upcoming challenges.
-
+A script that uses this `module` type can now use the `import` and `export` features you will learn about in the upcoming challenges.
-## Instructions
-
-Add a script to the HTML document of type module and give it the source file of index.js
-
+# --instructions--
-## Tests
-
+Add a script to the HTML document of type `module` and give it the source file of `index.js`
-```yml
-tests:
- - text: You should create a script tag.
- testString: assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g));
- - text: Your script tag should be of type module.
- testString: assert(code.match(/<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g));
- - text: Your script tag should have a src of index.js.
- testString: assert(code.match(/<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g));
+# --hints--
+
+You should create a `script` tag.
+
+```js
+assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g));
```
-
+Your `script` tag should be of type `module`.
-## Challenge Seed
-
-
+```js
+assert(
+ code.match(
+ /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g
+ )
+);
+```
+
+Your `script` tag should have a `src` of `index.js`.
+
+```js
+assert(
+ code.match(
+ /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g
+ )
+);
+```
+
+# --seed--
+
+## --seed-contents--
```html
@@ -50,11 +61,7 @@ tests:
```
-
-
-
-## Solution
-
+# --solutions--
```html
@@ -63,5 +70,3 @@ tests:
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md
index 31c180ee5b..ff0ddc1eb8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md
@@ -5,11 +5,13 @@ challengeType: 1
forumTopicId: 301199
---
-## Description
-
-In the export lesson, you learned about the syntax referred to as a named export. This allowed you to make multiple functions and variables available for use in other files.
-There is another export syntax you need to know, known as export default. Usually you will use this syntax if only one value is being exported from a file. It is also used to create a fallback value for a file or module.
-Below are examples using export default:
+# --description--
+
+In the `export` lesson, you learned about the syntax referred to as a named export. This allowed you to make multiple functions and variables available for use in other files.
+
+There is another `export` syntax you need to know, known as export default. Usually you will use this syntax if only one value is being exported from a file. It is also used to create a fallback value for a file or module.
+
+Below are examples using `export default`:
```js
// named function
@@ -23,28 +25,27 @@ export default function(x, y) {
}
```
-Since export default is used to declare a fallback value for a module or file, you can only have one value be a default export in each module or file. Additionally, you cannot use export default with var, let, or const
-
+Since `export default` is used to declare a fallback value for a module or file, you can only have one value be a default export in each module or file. Additionally, you cannot use `export default` with `var`, `let`, or `const`
+
+# --instructions--
-## Instructions
-
The following function should be the fallback value for the module. Please add the necessary code to do so.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should use export fallback.
- testString: assert(code.match(/export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g));
+Your code should use `export` fallback.
+
+```js
+assert(
+ code.match(
+ /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
+## --seed-contents--
```js
function subtract(x, y) {
@@ -52,16 +53,10 @@ function subtract(x, y) {
}
```
-
-
-
-## Solution
-
+# --solutions--
```js
export default function subtract(x, y) {
return x - y;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md
index 9bef6bff4b..0c794b5f40 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md
@@ -5,10 +5,12 @@ challengeType: 1
forumTopicId: 301200
---
-## Description
-
+# --description--
+
A new feature of ES6 is the template literal. This is a special type of string that makes creating complex strings easier.
+
Template literals allow you to create multi-line strings and to use string interpolation features to create strings.
+
Consider the code below:
```js
@@ -27,16 +29,12 @@ console.log(greeting); // prints
```
-A lot of things happened there.
-Firstly, the example uses backticks (`), not quotes (' or "), to wrap the string.
-Secondly, notice that the string is multi-line, both in the code and the output. This saves inserting \n within strings.
-The ${variable} syntax used above is a placeholder. Basically, you won't have to use concatenation with the + operator anymore. To add variables to strings, you just drop the variable in a template string and wrap it with ${ and }. Similarly, you can include other expressions in your string literal, for example ${a + b}.
-This new way of creating strings gives you more flexibility to create robust strings.
-
+A lot of things happened there. Firstly, the example uses backticks (`` ` ``), not quotes (`'` or `"`), to wrap the string. Secondly, notice that the string is multi-line, both in the code and the output. This saves inserting `\n` within strings. The `${variable}` syntax used above is a placeholder. Basically, you won't have to use concatenation with the `+` operator anymore. To add variables to strings, you just drop the variable in a template string and wrap it with `${` and `}`. Similarly, you can include other expressions in your string literal, for example `${a + b}`. This new way of creating strings gives you more flexibility to create robust strings.
+
+# --instructions--
+
+Use template literal syntax with backticks to create an array of list element (`li`) strings. Each list element's text should be one of the array elements from the `failure` property on the `result` object and have a `class` attribute with the value `text-warning`. The `makeList` function should return the array of list item strings.
-## Instructions
-
-Use template literal syntax with backticks to create an array of list element (li) strings. Each list element's text should be one of the array elements from the failure property on the result object and have a class attribute with the value text-warning. The makeList function should return the array of list item strings.
Use an iterator method (any kind of loop) to get the desired output (shown below).
```js
@@ -47,29 +45,44 @@ Use an iterator method (any kind of loop) to get the desired output (shown below
]
```
-
+# --hints--
-## Tests
-
+`failuresList` should be an array containing `result failure` messages.
-```yml
-tests:
- - text: failuresList should be an array containing result failure messages.
- testString: assert(typeof makeList(result.failure) === 'object' && failuresList.length === 3);
- - text: failuresList should be equal to the specified output.
- testString: assert(makeList(result.failure).every((v, i) => v === `
${result.failure[i]}
` || v === `
${result.failure[i]}
`));
- - text: Template strings and expression interpolation should be used.
- testString: getUserInput => assert(getUserInput('index').match(/(`.*\${.*}.*`)/));
- - text: An iterator should be used.
- testString: getUserInput => assert(getUserInput('index').match(/for|map|reduce|forEach|while/));
+```js
+assert(
+ typeof makeList(result.failure) === 'object' && failuresList.length === 3
+);
```
-
+`failuresList` should be equal to the specified output.
-## Challenge Seed
-
+```js
+assert(
+ makeList(result.failure).every(
+ (v, i) =>
+ v === `
${result.failure[i]}
` ||
+ v === `
${result.failure[i]}
`
+ )
+);
+```
-
+Template strings and expression interpolation should be used.
+
+```js
+(getUserInput) => assert(getUserInput('index').match(/(`.*\${.*}.*`)/));
+```
+
+An iterator should be used.
+
+```js
+(getUserInput) =>
+ assert(getUserInput('index').match(/for|map|reduce|forEach|while/));
+```
+
+# --seed--
+
+## --seed-contents--
```js
const result = {
@@ -88,14 +101,7 @@ function makeList(arr) {
const failuresList = makeList(result.failure);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const result = {
@@ -109,5 +115,3 @@ function makeList(arr) {
const failuresList = makeList(result.failure);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.md
index c127d57b5f..3449ed6f13 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.md
@@ -5,48 +5,55 @@ challengeType: 1
forumTopicId: 301201
---
-## Description
-
-The keyword let is not the only new way to declare variables. In ES6, you can also declare variables using the const keyword.
-const has all the awesome features that let has, with the added bonus that variables declared using const are read-only. They are a constant value, which means that once a variable is assigned with const, it cannot be reassigned.
+# --description--
+
+The keyword `let` is not the only new way to declare variables. In ES6, you can also declare variables using the `const` keyword.
+
+`const` has all the awesome features that `let` has, with the added bonus that variables declared using `const` are read-only. They are a constant value, which means that once a variable is assigned with `const`, it cannot be reassigned.
```js
const FAV_PET = "Cats";
FAV_PET = "Dogs"; // returns error
```
-As you can see, trying to reassign a variable declared with const will throw an error. You should always name variables you don't want to reassign using the const keyword. This helps when you accidentally attempt to reassign a variable that is meant to stay constant. A common practice when naming constants is to use all uppercase letters, with words separated by an underscore.
-
- Note: It is common for developers to use uppercase variable identifiers for immutable values and lowercase or camelCase for mutable values (objects and arrays). In a later challenge you will see an example of a lowercase variable identifier being used for an array.
-
+As you can see, trying to reassign a variable declared with `const` will throw an error. You should always name variables you don't want to reassign using the `const` keyword. This helps when you accidentally attempt to reassign a variable that is meant to stay constant. A common practice when naming constants is to use all uppercase letters, with words separated by an underscore.
-## Instructions
-
-Change the code so that all variables are declared using let or const. Use let when you want the variable to change, and const when you want the variable to remain constant. Also, rename variables declared with const to conform to common practices, meaning constants should be in all caps.
-
+**Note:** It is common for developers to use uppercase variable identifiers for immutable values and lowercase or camelCase for mutable values (objects and arrays). In a later challenge you will see an example of a lowercase variable identifier being used for an array.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: var should not exist in your code.
- testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- - text: SENTENCE should be a constant variable declared with const.
- testString: getUserInput => assert(getUserInput('index').match(/(const SENTENCE)/g));
- - text: i should be declared with let.
- testString: getUserInput => assert(getUserInput('index').match(/(let i)/g));
- - text: console.log should be changed to print the SENTENCE variable.
- testString: getUserInput => assert(getUserInput('index').match(/console\.log\(\s*SENTENCE\s*\)\s*;?/g));
+Change the code so that all variables are declared using `let` or `const`. Use `let` when you want the variable to change, and `const` when you want the variable to remain constant. Also, rename variables declared with `const` to conform to common practices, meaning constants should be in all caps.
+# --hints--
+
+`var` should not exist in your code.
+
+```js
+(getUserInput) => assert(!getUserInput('index').match(/var/g));
```
-
+`SENTENCE` should be a constant variable declared with `const`.
-## Challenge Seed
-
+```js
+(getUserInput) => assert(getUserInput('index').match(/(const SENTENCE)/g));
+```
-
+`i` should be declared with `let`.
+
+```js
+(getUserInput) => assert(getUserInput('index').match(/(let i)/g));
+```
+
+`console.log` should be changed to print the `SENTENCE` variable.
+
+```js
+(getUserInput) =>
+ assert(getUserInput('index').match(/console\.log\(\s*SENTENCE\s*\)\s*;?/g));
+```
+
+# --seed--
+
+## --seed-contents--
```js
function printManyTimes(str) {
@@ -64,14 +71,7 @@ function printManyTimes(str) {
printManyTimes("freeCodeCamp");
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function printManyTimes(str) {
@@ -84,5 +84,3 @@ function printManyTimes(str) {
}
printManyTimes("freeCodeCamp");
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.md
index 9869fb777d..bd9ec17d96 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.md
@@ -5,9 +5,9 @@ challengeType: 1
forumTopicId: 301202
---
-## Description
-
-One of the biggest problems with declaring variables with the var keyword is that you can overwrite variable declarations without an error.
+# --description--
+
+One of the biggest problems with declaring variables with the `var` keyword is that you can overwrite variable declarations without an error.
```js
var camper = 'James';
@@ -16,53 +16,48 @@ console.log(camper);
// logs 'David'
```
-As you can see in the code above, the camper variable is originally declared as James and then overridden to be David.
-In a small application, you might not run into this type of problem, but when your code becomes larger, you might accidentally overwrite a variable that you did not intend to overwrite.
-Because this behavior does not throw an error, searching and fixing bugs becomes more difficult.
-A new keyword called let was introduced in ES6 to solve this potential issue with the var keyword.
-If you were to replace var with let in the variable declarations of the code above, the result would be an error.
+As you can see in the code above, the `camper` variable is originally declared as `James` and then overridden to be `David`. In a small application, you might not run into this type of problem, but when your code becomes larger, you might accidentally overwrite a variable that you did not intend to overwrite. Because this behavior does not throw an error, searching and fixing bugs becomes more difficult.
+A new keyword called `let` was introduced in ES6 to solve this potential issue with the `var` keyword. If you were to replace `var` with `let` in the variable declarations of the code above, the result would be an error.
```js
let camper = 'James';
let camper = 'David'; // throws an error
```
-This error can be seen in the console of your browser.
-So unlike var, when using let, a variable with the same name can only be declared once.
-Note the "use strict". This enables Strict Mode, which catches common coding mistakes and "unsafe" actions. For instance:
+This error can be seen in the console of your browser. So unlike `var`, when using `let`, a variable with the same name can only be declared once. Note the `"use strict"`. This enables Strict Mode, which catches common coding mistakes and "unsafe" actions. For instance:
```js
"use strict";
x = 3.14; // throws an error because x is not declared
```
-
+# --instructions--
-## Instructions
-
-Update the code so it only uses the let keyword.
-
+Update the code so it only uses the `let` keyword.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: var should not exist in the code.
- testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- - text: catName should be Oliver.
- testString: assert(catName === "Oliver");
- - text: quote should be "Oliver says Meow!"
- testString: assert(quote === "Oliver says Meow!");
+`var` should not exist in the code.
+```js
+(getUserInput) => assert(!getUserInput('index').match(/var/g));
```
-
+`catName` should be `Oliver`.
-## Challenge Seed
-
+```js
+assert(catName === 'Oliver');
+```
-
+`quote` should be `"Oliver says Meow!"`
+
+```js
+assert(quote === 'Oliver says Meow!');
+```
+
+# --seed--
+
+## --seed-contents--
```js
var catName;
@@ -77,14 +72,7 @@ function catTalk() {
catTalk();
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
let catName;
@@ -97,5 +85,3 @@ function catTalk() {
}
catTalk();
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md
index 3f2cb45d01..b4c2a091db 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md
@@ -5,9 +5,9 @@ challengeType: 1
forumTopicId: 301203
---
-## Description
-
-Promises are most useful when you have a process that takes an unknown amount of time in your code (i.e. something asynchronous), often a server request. When you make a server request it takes some amount of time, and after it completes you usually want to do something with the response from the server. This can be achieved by using the then method. The then method is executed immediately after your promise is fulfilled with resolve. Here’s an example:
+# --description--
+
+Promises are most useful when you have a process that takes an unknown amount of time in your code (i.e. something asynchronous), often a server request. When you make a server request it takes some amount of time, and after it completes you usually want to do something with the response from the server. This can be achieved by using the `then` method. The `then` method is executed immediately after your promise is fulfilled with `resolve`. Here’s an example:
```js
myPromise.then(result => {
@@ -15,69 +15,72 @@ myPromise.then(result => {
});
```
-result comes from the argument given to the resolve method.
-
+`result` comes from the argument given to the `resolve` method.
-## Instructions
-
-Add the then method to your promise. Use result as the parameter of its callback function and log result to the console.
-
+# --instructions--
-## Tests
-
+Add the `then` method to your promise. Use `result` as the parameter of its callback function and log `result` to the console.
-```yml
-tests:
- - text: You should call the then method on the promise.
- testString: assert(__helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g));
- - text: Your then method should have a callback function with result as its parameter.
- testString: assert(resultIsParameter);
- - text: You should log result to the console.
- testString: assert(resultIsParameter && __helpers.removeWhiteSpace(code).match(/\.then\(.*?result.*?console.log\(result\).*?\)/));
-```
+# --hints--
-
-
-## Challenge Seed
-
-
+You should call the `then` method on the promise.
```js
-const makeServerRequest = new Promise((resolve, reject) => {
- // responseFromServer is set to true to represent a successful response from a server
- let responseFromServer = true;
-
- if(responseFromServer) {
- resolve("We got the data");
- } else {
- reject("Data not received");
- }
-});
+assert(
+ __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g)
+);
```
-
+Your `then` method should have a callback function with `result` as its parameter.
-### After Test
-
-
-
-## Solution
-
+## --seed-contents--
```js
const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer is set to true to represent a successful response from a server
let responseFromServer = true;
-
+
if(responseFromServer) {
resolve("We got the data");
- } else {
+ } else {
+ reject("Data not received");
+ }
+});
+```
+
+# --solutions--
+
+```js
+const makeServerRequest = new Promise((resolve, reject) => {
+ // responseFromServer is set to true to represent a successful response from a server
+ let responseFromServer = true;
+
+ if(responseFromServer) {
+ resolve("We got the data");
+ } else {
reject("Data not received");
}
});
@@ -86,5 +89,3 @@ makeServerRequest.then(result => {
console.log(result);
});
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md
index 5d3badadba..aac6ac88ce 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md
@@ -5,9 +5,9 @@ challengeType: 1
forumTopicId: 301204
---
-## Description
-
-catch is the method used when your promise has been rejected. It is executed immediately after a promise's reject method is called. Here’s the syntax:
+# --description--
+
+`catch` is the method used when your promise has been rejected. It is executed immediately after a promise's `reject` method is called. Here’s the syntax:
```js
myPromise.catch(error => {
@@ -15,41 +15,57 @@ myPromise.catch(error => {
});
```
-error is the argument passed in to the reject method.
-
+`error` is the argument passed in to the `reject` method.
-## Instructions
-
-Add the catch method to your promise. Use error as the parameter of its callback function and log error to the console.
-
+# --instructions--
-## Tests
-
+Add the `catch` method to your promise. Use `error` as the parameter of its callback function and log `error` to the console.
-```yml
-tests:
- - text: You should call the catch method on the promise.
- testString: assert(__helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g));
- - text: Your catch method should have a callback function with error as its parameter.
- testString: assert(errorIsParameter);
- - text: You should log error to the console.
- testString: assert(errorIsParameter && __helpers.removeWhiteSpace(code).match(/\.catch\(.*?error.*?console.log\(error\).*?\)/));
+# --hints--
+
+You should call the `catch` method on the promise.
+
+```js
+assert(
+ __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g)
+);
```
-
+Your `catch` method should have a callback function with `error` as its parameter.
-## Challenge Seed
-
-
+```js
+assert(errorIsParameter);
+```
+
+You should log `error` to the console.
+
+```js
+assert(
+ errorIsParameter &&
+ __helpers
+ .removeWhiteSpace(code)
+ .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/)
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code));
+```
+
+## --seed-contents--
```js
const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer is set to false to represent an unsuccessful response from a server
let responseFromServer = false;
-
+
if(responseFromServer) {
resolve("We got the data");
- } else {
+ } else {
reject("Data not received");
}
});
@@ -59,30 +75,16 @@ makeServerRequest.then(result => {
});
```
-
-
-
-
-## Solution
-
+# --solutions--
```js
const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer is set to false to represent an unsuccessful response from a server
let responseFromServer = false;
-
+
if(responseFromServer) {
resolve("We got the data");
- } else {
+ } else {
reject("Data not received");
}
});
@@ -95,5 +97,3 @@ makeServerRequest.catch(error => {
console.log(error);
});
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md
index cf04c52cf8..9731423ebf 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md
@@ -5,36 +5,31 @@ challengeType: 1
forumTopicId: 301205
---
-## Description
-
-In the last challenge, you learned about export default and its uses. To import a default export, you need to use a different import syntax. In the following example, add is the default export of the math_functions.js file. Here is how to import it:
+# --description--
+
+In the last challenge, you learned about `export default` and its uses. To import a default export, you need to use a different `import` syntax. In the following example, `add` is the default export of the `math_functions.js` file. Here is how to import it:
```js
import add from "./math_functions.js";
```
-The syntax differs in one key place. The imported value, add, is not surrounded by curly braces ({}). add here is simply a variable name for whatever the default export of the math_functions.js file is. You can use any name here when importing a default.
-
+The syntax differs in one key place. The imported value, `add`, is not surrounded by curly braces (`{}`). `add` here is simply a variable name for whatever the default export of the `math_functions.js` file is. You can use any name here when importing a default.
-## Instructions
-
-In the following code, import the default export from the math_functions.js file, found in the same directory as this file. Give the import the name subtract.
-
+# --instructions--
-## Tests
-
+In the following code, import the default export from the `math_functions.js` file, found in the same directory as this file. Give the import the name `subtract`.
-```yml
-tests:
- - text: You should properly import subtract from math_functions.js.
- testString: assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g));
+# --hints--
+
+You should properly import `subtract` from `math_functions.js`.
+
+```js
+assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g));
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
-## Solution
-
+# --solutions--
```js
import subtract from "./math_functions.js";
subtract(7,4);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md
index 679a285acd..3880334982 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md
@@ -5,11 +5,13 @@ challengeType: 1
forumTopicId: 301206
---
-## Description
-
-The const declaration has many use cases in modern JavaScript.
-Some developers prefer to assign all their variables using const by default, unless they know they will need to reassign the value. Only in that case, they use let.
-However, it is important to understand that objects (including arrays and functions) assigned to a variable using const are still mutable. Using the const declaration only prevents reassignment of the variable identifier.
+# --description--
+
+The `const` declaration has many use cases in modern JavaScript.
+
+Some developers prefer to assign all their variables using `const` by default, unless they know they will need to reassign the value. Only in that case, they use `let`.
+
+However, it is important to understand that objects (including arrays and functions) assigned to a variable using `const` are still mutable. Using the `const` declaration only prevents reassignment of the variable identifier.
```js
const s = [5, 6, 7];
@@ -18,36 +20,46 @@ s[2] = 45; // works just as it would with an array declared with var or let
console.log(s); // returns [5, 6, 45]
```
-As you can see, you can mutate the object [5, 6, 7] itself and the variable s will still point to the altered array [5, 6, 45]. Like all arrays, the array elements in s are mutable, but because const was used, you cannot use the variable identifier s to point to a different array using the assignment operator.
-
+As you can see, you can mutate the object `[5, 6, 7]` itself and the variable `s` will still point to the altered array `[5, 6, 45]`. Like all arrays, the array elements in `s` are mutable, but because `const` was used, you cannot use the variable identifier `s` to point to a different array using the assignment operator.
-## Instructions
-
-An array is declared as const s = [5, 7, 2]. Change the array to [2, 5, 7] using various element assignments.
-
+# --instructions--
-## Tests
-
+An array is declared as `const s = [5, 7, 2]`. Change the array to `[2, 5, 7]` using various element assignments.
-```yml
-tests:
- - text: You should not replace const keyword.
- testString: getUserInput => assert(getUserInput('index').match(/const/g));
- - text: s should be a constant variable (by using const).
- testString: getUserInput => assert(getUserInput('index').match(/const\s+s/g));
- - text: You should not change the original array declaration.
- testString: getUserInput => assert(getUserInput('index').match(/const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g));
- - text: s should be equal to [2, 5, 7].
- testString: assert.deepEqual(s, [2, 5, 7]);
+# --hints--
+You should not replace `const` keyword.
+
+```js
+(getUserInput) => assert(getUserInput('index').match(/const/g));
```
-
+`s` should be a constant variable (by using `const`).
-## Challenge Seed
-
+```js
+(getUserInput) => assert(getUserInput('index').match(/const\s+s/g));
+```
-
+You should not change the original array declaration.
+
+```js
+(getUserInput) =>
+ assert(
+ getUserInput('index').match(
+ /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g
+ )
+ );
+```
+
+`s` should be equal to `[2, 5, 7]`.
+
+```js
+assert.deepEqual(s, [2, 5, 7]);
+```
+
+# --seed--
+
+## --seed-contents--
```js
const s = [5, 7, 2];
@@ -61,14 +73,7 @@ function editInPlace() {
editInPlace();
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const s = [5, 7, 2];
@@ -79,5 +84,3 @@ function editInPlace() {
}
editInPlace();
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md
index 7eece62244..8c6ac79d4d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 301207
---
-## Description
-
-As seen in the previous challenge, const declaration alone doesn't really protect your data from mutation. To ensure your data doesn't change, JavaScript provides a function Object.freeze to prevent data mutation.
+# --description--
+
+As seen in the previous challenge, `const` declaration alone doesn't really protect your data from mutation. To ensure your data doesn't change, JavaScript provides a function `Object.freeze` to prevent data mutation.
+
Once the object is frozen, you can no longer add, update, or delete properties from it. Any attempt at changing the object will be rejected without an error.
```js
@@ -22,35 +23,45 @@ console.log(obj);
// { name: "FreeCodeCamp", review:"Awesome"}
```
-
+# --instructions--
-## Instructions
-
-In this challenge you are going to use Object.freeze to prevent mathematical constants from changing. You need to freeze the MATH_CONSTANTS object so that no one is able to alter the value of PI, add, or delete properties.
-
+In this challenge you are going to use `Object.freeze` to prevent mathematical constants from changing. You need to freeze the `MATH_CONSTANTS` object so that no one is able to alter the value of `PI`, add, or delete properties.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should not replace const keyword.
- testString: getUserInput => assert(getUserInput('index').match(/const/g));
- - text: MATH_CONSTANTS should be a constant variable (by using const).
- testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS/g));
- - text: You should not change original MATH_CONSTANTS.
- testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g));
- - text: PI should equal 3.14.
- testString: assert(PI === 3.14);
+You should not replace `const` keyword.
+```js
+(getUserInput) => assert(getUserInput('index').match(/const/g));
```
-
+`MATH_CONSTANTS` should be a constant variable (by using `const`).
-## Challenge Seed
-
+```js
+(getUserInput) =>
+ assert(getUserInput('index').match(/const\s+MATH_CONSTANTS/g));
+```
-
+You should not change original `MATH_CONSTANTS`.
+
+```js
+(getUserInput) =>
+ assert(
+ getUserInput('index').match(
+ /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g
+ )
+ );
+```
+
+`PI` should equal `3.14`.
+
+```js
+assert(PI === 3.14);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function freezeObj() {
@@ -71,14 +82,7 @@ function freezeObj() {
const PI = freezeObj();
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function freezeObj() {
@@ -96,5 +100,3 @@ function freezeObj() {
}
const PI = freezeObj();
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md
index f4a0d68c0a..6d9b28067f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md
@@ -5,45 +5,51 @@ challengeType: 1
forumTopicId: 301208
---
-## Description
-
-import allows you to choose which parts of a file or module to load. In the previous lesson, the examples exported add from the math_functions.js file. Here's how you can import it to use in another file:
+# --description--
+
+`import` allows you to choose which parts of a file or module to load. In the previous lesson, the examples exported `add` from the `math_functions.js` file. Here's how you can import it to use in another file:
```js
import { add } from './math_functions.js';
```
-Here, import will find add in math_functions.js, import just that function for you to use, and ignore the rest. The ./ tells the import to look for the math_functions.js file in the same folder as the current file. The relative file path (./) and file extension (.js) are required when using import in this way.
+Here, `import` will find `add` in `math_functions.js`, import just that function for you to use, and ignore the rest. The `./` tells the import to look for the `math_functions.js` file in the same folder as the current file. The relative file path (`./`) and file extension (`.js`) are required when using import in this way.
-You can import more than one item from the file by adding them in the import statement like this:
+You can import more than one item from the file by adding them in the `import` statement like this:
```js
import { add, subtract } from './math_functions.js';
```
-
+# --instructions--
-## Instructions
-
-Add the appropriate import statement that will allow the current file to use the uppercaseString and lowercaseString functions you exported in the previous lesson. These functions are in a file called string_functions.js, which is in the same directory as the current file.
-
+Add the appropriate `import` statement that will allow the current file to use the `uppercaseString` and `lowercaseString` functions you exported in the previous lesson. These functions are in a file called `string_functions.js`, which is in the same directory as the current file.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should properly import uppercaseString.
- testString: assert(code.match(/import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g));
- - text: You should properly import lowercaseString.
- testString: assert(code.match(/import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g));
+You should properly import `uppercaseString`.
+
+```js
+assert(
+ code.match(
+ /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g
+ )
+);
```
-
+You should properly import `lowercaseString`.
-## Challenge Seed
-
-
-
-
-## Solution
-
+# --solutions--
```js
import { uppercaseString, lowercaseString } from './string_functions.js';
@@ -65,5 +67,3 @@ import { uppercaseString, lowercaseString } from './string_functions.js';
uppercaseString("hello");
lowercaseString("WORLD!");
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md
index 555f79b8c1..4b676210cc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 301209
---
-## Description
-
+# --description--
+
In order to help us create more flexible functions, ES6 introduces default parameters for functions.
+
Check out this code:
```js
@@ -17,34 +18,35 @@ console.log(greeting("John")); // Hello John
console.log(greeting()); // Hello Anonymous
```
-The default parameter kicks in when the argument is not specified (it is undefined). As you can see in the example above, the parameter name will receive its default value "Anonymous" when you do not provide a value for the parameter. You can add default values for as many parameters as you want.
-
+The default parameter kicks in when the argument is not specified (it is undefined). As you can see in the example above, the parameter `name` will receive its default value `"Anonymous"` when you do not provide a value for the parameter. You can add default values for as many parameters as you want.
-## Instructions
-
-Modify the function increment by adding default parameters so that it will add 1 to number if value is not specified.
-
+# --instructions--
-## Tests
-
+Modify the function `increment` by adding default parameters so that it will add 1 to `number` if `value` is not specified.
-```yml
-tests:
- - text: The result of increment(5, 2) should be 7.
- testString: assert(increment(5, 2) === 7);
- - text: The result of increment(5) should be 6.
- testString: assert(increment(5) === 6);
- - text: A default parameter value of 1 should be used for value.
- testString: assert(code.match(/value\s*=\s*1/g));
+# --hints--
+The result of `increment(5, 2)` should be `7`.
+
+```js
+assert(increment(5, 2) === 7);
```
-
+The result of `increment(5)` should be `6`.
-## Challenge Seed
-
+```js
+assert(increment(5) === 6);
+```
-
+A default parameter value of `1` should be used for `value`.
+
+```js
+assert(code.match(/value\s*=\s*1/g));
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Only change code below this line
@@ -52,17 +54,8 @@ const increment = (number, value) => number + value;
// Only change code above this line
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const increment = (number, value = 1) => number + value;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md
index a1f22d84dd..87e4a6ae4f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md
@@ -5,56 +5,49 @@ challengeType: 1
forumTopicId: 301210
---
-## Description
-
-Suppose you have a file and you wish to import all of its contents into the current file. This can be done with the import * as syntax. Here's an example where the contents of a file named math_functions.js are imported into a file in the same directory:
+# --description--
+
+Suppose you have a file and you wish to import all of its contents into the current file. This can be done with the `import * as` syntax. Here's an example where the contents of a file named `math_functions.js` are imported into a file in the same directory:
```js
import * as myMathModule from "./math_functions.js";
```
-The above import statement will create an object called myMathModule. This is just a variable name, you can name it anything. The object will contain all of the exports from math_functions.js in it, so you can access the functions like you would any other object property. Here's how you can use the add and subtract functions that were imported:
+The above `import` statement will create an object called `myMathModule`. This is just a variable name, you can name it anything. The object will contain all of the exports from `math_functions.js` in it, so you can access the functions like you would any other object property. Here's how you can use the `add` and `subtract` functions that were imported:
```js
myMathModule.add(2,3);
myMathModule.subtract(5,3);
```
-
+# --instructions--
-## Instructions
-
-The code in this file requires the contents of the file: string_functions.js, that is in the same directory as the current file. Use the import * as syntax to import everything from the file into an object called stringFunctions.
-
+The code in this file requires the contents of the file: `string_functions.js`, that is in the same directory as the current file. Use the `import * as` syntax to import everything from the file into an object called `stringFunctions`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should properly use import * as syntax.
- testString: assert(code.match(/import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g));
-```
-
-
-
-## Challenge Seed
-
-
+Your code should properly use `import * as` syntax.
```js
+assert(
+ code.match(
+ /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g
+ )
+);
+```
+# --seed--
+
+## --seed-contents--
+
+```js
// Only change code above this line
stringFunctions.uppercaseString("hello");
stringFunctions.lowercaseString("WORLD!");
```
-
-
-
-## Solution
-
+# --solutions--
```js
import * as stringFunctions from "./string_functions.js";
@@ -63,5 +56,3 @@ import * as stringFunctions from "./string_functions.js";
stringFunctions.uppercaseString("hello");
stringFunctions.lowercaseString("WORLD!");
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.md
index 61a5cc5a26..bdd9d1a866 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 301211
---
-## Description
-
+# --description--
+
In JavaScript, we often don't need to name our functions, especially when passing a function as an argument to another function. Instead, we create inline functions. We don't need to name these functions because we do not reuse them anywhere else.
+
To achieve this, we often use the following syntax:
```js
@@ -17,7 +18,7 @@ const myFunc = function() {
}
```
-ES6 provides us with the syntactic sugar to not have to write anonymous functions this way. Instead, you can use arrow function syntax:
+ES6 provides us with the syntactic sugar to not have to write anonymous functions this way. Instead, you can use **arrow function syntax**:
```js
const myFunc = () => {
@@ -26,44 +27,53 @@ const myFunc = () => {
}
```
-When there is no function body, and only a return value, arrow function syntax allows you to omit the keyword return as well as the brackets surrounding the code. This helps simplify smaller functions into one-line statements:
+When there is no function body, and only a return value, arrow function syntax allows you to omit the keyword `return` as well as the brackets surrounding the code. This helps simplify smaller functions into one-line statements:
```js
const myFunc = () => "value";
```
-This code will still return the string value by default.
-
+This code will still return the string `value` by default.
-## Instructions
-
-Rewrite the function assigned to the variable magic which returns a new Date() to use arrow function syntax. Also, make sure nothing is defined using the keyword var.
-
+# --instructions--
-## Tests
-
+Rewrite the function assigned to the variable `magic` which returns a `new Date()` to use arrow function syntax. Also, make sure nothing is defined using the keyword `var`.
-```yml
-tests:
- - text: User should replace var keyword.
- testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- - text: magic should be a constant variable (by using const).
- testString: getUserInput => assert(getUserInput('index').match(/const\s+magic/g));
- - text: magic should be a function.
- testString: assert(typeof magic === 'function');
- - text: magic() should return correct date.
- testString: assert(magic().setHours(0,0,0,0) === new Date().setHours(0,0,0,0));
- - text: function keyword should not be used.
- testString: getUserInput => assert(!getUserInput('index').match(/function/g));
+# --hints--
+User should replace `var` keyword.
+
+```js
+(getUserInput) => assert(!getUserInput('index').match(/var/g));
```
-
+`magic` should be a constant variable (by using `const`).
-## Challenge Seed
-
+```js
+(getUserInput) => assert(getUserInput('index').match(/const\s+magic/g));
+```
-
+`magic` should be a `function`.
+
+```js
+assert(typeof magic === 'function');
+```
+
+`magic()` should return correct date.
+
+```js
+assert(magic().setHours(0, 0, 0, 0) === new Date().setHours(0, 0, 0, 0));
+```
+
+`function` keyword should not be used.
+
+```js
+(getUserInput) => assert(!getUserInput('index').match(/function/g));
+```
+
+# --seed--
+
+## --seed-contents--
```js
var magic = function() {
@@ -71,19 +81,10 @@ var magic = function() {
};
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const magic = () => {
return new Date();
};
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md
index ed67216604..6982511976 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md
@@ -5,11 +5,13 @@ challengeType: 1
forumTopicId: 301212
---
-## Description
-
+# --description--
+
ES6 provides a new syntax to create objects, using the class keyword.
-It should be noted that the class syntax is just syntax, and not a full-fledged class-based implementation of an object-oriented paradigm, unlike in languages such as Java, Python, Ruby, etc.
-In ES5, we usually define a constructor function and use the new keyword to instantiate an object.
+
+It should be noted that the `class` syntax is just syntax, and not a full-fledged class-based implementation of an object-oriented paradigm, unlike in languages such as Java, Python, Ruby, etc.
+
+In ES5, we usually define a constructor function and use the `new` keyword to instantiate an object.
```js
var SpaceShuttle = function(targetPlanet){
@@ -18,7 +20,7 @@ var SpaceShuttle = function(targetPlanet){
var zeus = new SpaceShuttle('Jupiter');
```
-The class syntax simply replaces the constructor function creation:
+The `class` syntax simply replaces the constructor function creation:
```js
class SpaceShuttle {
@@ -29,40 +31,52 @@ class SpaceShuttle {
const zeus = new SpaceShuttle('Jupiter');
```
-It should be noted that the class keyword declares a new function, to which a constructor is added. This constructor is invoked when new is called to create a new object.
-Notes:
-
UpperCamelCase should be used by convention for ES6 class names, as in SpaceShuttle used above.
-
The constructor method is a special method for creating and initializing an object created with a class. You will learn more about it in the Object Oriented Programming section of the JavaScript Algorithms And Data Structures Certification.
-
+It should be noted that the `class` keyword declares a new function, to which a constructor is added. This constructor is invoked when `new` is called to create a new object.
+**Notes:**
-## Instructions
-
-Use the class keyword and write a constructor to create the Vegetable class.
-The Vegetable class allows you to create a vegetable object with a property name that gets passed to the constructor.
-
+- UpperCamelCase should be used by convention for ES6 class names, as in `SpaceShuttle` used above.
+- The constructor method is a special method for creating and initializing an object created with a class. You will learn more about it in the Object Oriented Programming section of the JavaScript Algorithms And Data Structures Certification.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Vegetable should be a class with a defined constructor method.
- testString: assert(typeof Vegetable === 'function' && typeof Vegetable.constructor === 'function');
- - text: class keyword should be used.
- testString: assert(code.match(/class/g));
- - text: Vegetable should be able to be instantiated.
- testString: assert(() => {const a = new Vegetable("apple"); return typeof a === 'object';});
- - text: carrot.name should return carrot.
- testString: assert(carrot.name=='carrot');
+Use the `class` keyword and write a constructor to create the `Vegetable` class.
+The `Vegetable` class allows you to create a vegetable object with a property `name` that gets passed to the constructor.
+
+# --hints--
+
+`Vegetable` should be a `class` with a defined `constructor` method.
+
+```js
+assert(
+ typeof Vegetable === 'function' && typeof Vegetable.constructor === 'function'
+);
```
-
+`class` keyword should be used.
-## Challenge Seed
-
+```js
+assert(code.match(/class/g));
+```
-
+`Vegetable` should be able to be instantiated.
+
+```js
+assert(() => {
+ const a = new Vegetable('apple');
+ return typeof a === 'object';
+});
+```
+
+`carrot.name` should return `carrot`.
+
+```js
+assert(carrot.name == 'carrot');
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Only change code below this line
@@ -73,14 +87,7 @@ const carrot = new Vegetable('carrot');
console.log(carrot.name); // Should display 'carrot'
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
class Vegetable {
@@ -90,5 +97,3 @@ class Vegetable {
}
const carrot = new Vegetable('carrot');
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md
index 98f31c4779..94f22369ab 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md
@@ -5,10 +5,12 @@ challengeType: 1
forumTopicId: 301213
---
-## Description
-
+# --description--
+
ES6 makes destructuring arrays as easy as destructuring objects.
+
One key difference between the spread operator and array destructuring is that the spread operator unpacks all contents of an array into a comma-separated list. Consequently, you cannot pick or choose which elements you want to assign to variables.
+
Destructuring an array lets us do exactly that:
```js
@@ -16,60 +18,49 @@ const [a, b] = [1, 2, 3, 4, 5, 6];
console.log(a, b); // 1, 2
```
-The variable a is assigned the first value of the array, and b is assigned the second value of the array.
-We can also access the value at any index in an array with destructuring by using commas to reach the desired index:
+The variable `a` is assigned the first value of the array, and `b` is assigned the second value of the array. We can also access the value at any index in an array with destructuring by using commas to reach the desired index:
```js
const [a, b,,, c] = [1, 2, 3, 4, 5, 6];
console.log(a, b, c); // 1, 2, 5
```
-
+# --instructions--
-## Instructions
-
-Use destructuring assignment to swap the values of a and b so that a receives the value stored in b, and b receives the value stored in a.
-
+Use destructuring assignment to swap the values of `a` and `b` so that `a` receives the value stored in `b`, and `b` receives the value stored in `a`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Value of a should be 6, after swapping.
- testString: assert(a === 6);
- - text: Value of b should be 8, after swapping.
- testString: assert(b === 8);
- - text: You should use array destructuring to swap a and b.
- testString: assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code));
+Value of `a` should be 6, after swapping.
+```js
+assert(a === 6);
```
-
+Value of `b` should be 8, after swapping.
-## Challenge Seed
-
+```js
+assert(b === 8);
+```
-
+You should use array destructuring to swap a and b.
+
+```js
+assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code));
+```
+
+# --seed--
+
+## --seed-contents--
```js
let a = 8, b = 6;
// Only change code below this line
-
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
let a = 8, b = 6;
[a, b] = [b, a];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md
index 8fceb1ce80..7c09d172c1 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md
@@ -5,8 +5,8 @@ challengeType: 1
forumTopicId: 301214
---
-## Description
-
+# --description--
+
You can use the same principles from the previous two lessons to destructure values from nested objects.
Using an object similar to previous examples:
@@ -32,33 +32,50 @@ And here's how you can assign an object properties' values to variables with dif
const { johnDoe: { age: userAge, email: userEmail }} = user;
```
-
+# --instructions--
-## Instructions
-
-Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables lowToday and highToday the values of today.low and today.high from the LOCAL_FORECAST object.
-
+Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables `lowToday` and `highToday` the values of `today.low` and `today.high` from the `LOCAL_FORECAST` object.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should remove the ES5 assignment syntax.
- testString: assert(!code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && !code.match(/highToday = LOCAL_FORECAST\.today.high/g))
- - text: You should use destructuring to create the lowToday variable.
- testString: assert(code.match(/(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)}\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g));
- - text: You should use destructuring to create the highToday variable.
- testString: assert(code.match(/(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday\s*)}\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g));
- - text: lowToday should be equal to 64 and highToday should be equal to 77.
- testString: assert(lowToday === 64 && highToday === 77);
+You should remove the ES5 assignment syntax.
+
+```js
+assert(
+ !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) &&
+ !code.match(/highToday = LOCAL_FORECAST\.today.high/g)
+);
```
-
+You should use destructuring to create the `lowToday` variable.
-## Challenge Seed
-
-
+```js
+assert(
+ code.match(
+ /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)}\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g
+ )
+);
+```
+
+You should use destructuring to create the `highToday` variable.
+
+```js
+assert(
+ code.match(
+ /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday\s*)}\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g
+ )
+);
+```
+
+`lowToday` should be equal to `64` and `highToday` should be equal to `77`.
+
+```js
+assert(lowToday === 64 && highToday === 77);
+```
+
+# --seed--
+
+## --seed-contents--
```js
const LOCAL_FORECAST = {
@@ -75,11 +92,7 @@ const highToday = LOCAL_FORECAST.today.high;
// Only change code above this line
```
-
-
-
-## Solution
-
+# --solutions--
```js
const LOCAL_FORECAST = {
@@ -90,5 +103,3 @@ const LOCAL_FORECAST = {
const { today: { low: lowToday, high: highToday }} = LOCAL_FORECAST;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md
index 2f209530dd..c06b6b1916 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md
@@ -5,8 +5,8 @@ challengeType: 1
forumTopicId: 301215
---
-## Description
-
+# --description--
+
Destructuring allows you to assign a new variable name when extracting values. You can do this by putting the new name after a colon when assigning the value.
Using the same object from the last example:
@@ -22,34 +22,52 @@ const { name: userName, age: userAge } = user;
// userName = 'John Doe', userAge = 34
```
-You may read it as "get the value of user.name and assign it to a new variable named userName" and so on.
-
+You may read it as "get the value of `user.name` and assign it to a new variable named `userName`" and so on.
-## Instructions
-
-Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables highToday and highTomorrow the values of today and tomorrow from the HIGH_TEMPERATURES object.
-
+# --instructions--
-## Tests
-
+Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables `highToday` and `highTomorrow` the values of `today` and `tomorrow` from the `HIGH_TEMPERATURES` object.
-```yml
-tests:
- - text: You should remove the ES5 assignment syntax.
- testString: assert(!code.match(/highToday = HIGH_TEMPERATURES\.today/g) && !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g))
- - text: You should use destructuring to create the highToday variable.
- testString: assert(code.match(/(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g));
- - text: You should use destructuring to create the highTomorrow variable.
- testString: assert(code.match(/(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g));
- - text: highToday should be equal to 77 and highTomorrow should be equal to 80.
- testString: assert(highToday === 77 && highTomorrow === 80);
+# --hints--
+
+You should remove the ES5 assignment syntax.
+
+```js
+assert(
+ !code.match(/highToday = HIGH_TEMPERATURES\.today/g) &&
+ !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g)
+);
```
-
+You should use destructuring to create the `highToday` variable.
-## Challenge Seed
-
-
+```js
+assert(
+ code.match(
+ /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g
+ )
+);
+```
+
+You should use destructuring to create the `highTomorrow` variable.
+
+```js
+assert(
+ code.match(
+ /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g
+ )
+);
+```
+
+`highToday` should be equal to `77` and `highTomorrow` should be equal to `80`.
+
+```js
+assert(highToday === 77 && highTomorrow === 80);
+```
+
+# --seed--
+
+## --seed-contents--
```js
const HIGH_TEMPERATURES = {
@@ -66,11 +84,7 @@ const highTomorrow = HIGH_TEMPERATURES.tomorrow;
// Only change code above this line
```
-
-
-
-## Solution
-
+# --solutions--
```js
const HIGH_TEMPERATURES = {
@@ -81,5 +95,3 @@ const HIGH_TEMPERATURES = {
const { today: highToday, tomorrow: highTomorrow } = HIGH_TEMPERATURES;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md
index 33a74c160f..f6b2bbd8fc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md
@@ -5,8 +5,8 @@ challengeType: 1
forumTopicId: 301216
---
-## Description
-
+# --description--
+
Destructuring assignment is special syntax introduced in ES6, for neatly assigning values taken directly from an object.
Consider the following ES5 code:
@@ -25,37 +25,59 @@ const { name, age } = user;
// name = 'John Doe', age = 34
```
-Here, the name and age variables will be created and assigned the values of their respective values from the user object. You can see how much cleaner this is.
+Here, the `name` and `age` variables will be created and assigned the values of their respective values from the `user` object. You can see how much cleaner this is.
You can extract as many or few values from the object as you want.
-
-## Instructions
-
-Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables today and tomorrow the values of today and tomorrow from the HIGH_TEMPERATURES object.
-
+# --instructions--
-## Tests
-
+Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables `today` and `tomorrow` the values of `today` and `tomorrow` from the `HIGH_TEMPERATURES` object.
-```yml
-tests:
- - text: You should remove the ES5 assignment syntax.
- testString: assert(!__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g))
- - text: You should use destructuring to create the today variable.
- testString: assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g));
- - text: You should use destructuring to create the tomorrow variable.
- testString: assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g));
- - text: today should be equal to 77 and tomorrow should be equal to 80.
- testString: assert(today === 77 && tomorrow === 80);
+# --hints--
+You should remove the ES5 assignment syntax.
+
+```js
+assert(
+ !__helpers
+ .removeJSComments(code)
+ .match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g)
+);
```
-
+You should use destructuring to create the `today` variable.
-## Challenge Seed
-
-
+```js
+assert(
+ __helpers
+ .removeJSComments(code)
+ .match(
+ /(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g
+ )
+);
+```
+
+You should use destructuring to create the `tomorrow` variable.
+
+```js
+assert(
+ __helpers
+ .removeJSComments(code)
+ .match(
+ /(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g
+ )
+);
+```
+
+`today` should be equal to `77` and `tomorrow` should be equal to `80`.
+
+```js
+assert(today === 77 && tomorrow === 80);
+```
+
+# --seed--
+
+## --seed-contents--
```js
const HIGH_TEMPERATURES = {
@@ -72,12 +94,7 @@ const tomorrow = HIGH_TEMPERATURES.tomorrow;
// Only change code above this line
```
-
-
-
-
-## Solution
-
+# --solutions--
```js
const HIGH_TEMPERATURES = {
@@ -88,5 +105,3 @@ const HIGH_TEMPERATURES = {
const { today, tomorrow } = HIGH_TEMPERATURES;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md
index 85f300c3c5..bd4bbc6c4b 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 301217
---
-## Description
-
+# --description--
+
In some cases, you can destructure the object in a function argument itself.
+
Consider the code below:
```js
@@ -25,36 +26,41 @@ const profileUpdate = ({ name, age, nationality, location }) => {
}
```
-When profileData is passed to the above function, the values are destructured from the function parameter for use within the function.
-
+When `profileData` is passed to the above function, the values are destructured from the function parameter for use within the function.
-## Instructions
-
-Use destructuring assignment within the argument to the function half to send only max and min inside the function.
-
+# --instructions--
-## Tests
-
+Use destructuring assignment within the argument to the function `half` to send only `max` and `min` inside the function.
-```yml
-tests:
- - text: stats should be an object.
- testString: assert(typeof stats === 'object');
- - text: half(stats) should be 28.015
- testString: assert(half(stats) === 28.015);
- - text: Destructuring should be used.
- testString: assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/));
- - text: Destructured parameter should be used.
- testString: assert(!code.match(/stats\.max|stats\.min/));
+# --hints--
+`stats` should be an `object`.
+
+```js
+assert(typeof stats === 'object');
```
-
+`half(stats)` should be `28.015`
-## Challenge Seed
-
+```js
+assert(half(stats) === 28.015);
+```
-
+Destructuring should be used.
+
+```js
+assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/));
+```
+
+Destructured parameter should be used.
+
+```js
+assert(!code.match(/stats\.max|stats\.min/));
+```
+
+# --seed--
+
+## --seed-contents--
```js
const stats = {
@@ -69,17 +75,9 @@ const stats = {
// Only change code below this line
const half = (stats) => (stats.max + stats.min) / 2.0;
// Only change code above this line
-
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const stats = {
@@ -93,5 +91,3 @@ const stats = {
const half = ( {max, min} ) => (max + min) / 2.0;
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md
index 7eaec45eb6..db59d04e07 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md
@@ -1,14 +1,17 @@
---
id: 587d7b8a367417b2b2512b4c
-title: Use Destructuring Assignment with the Rest Parameter to Reassign Array Elements
+title: >-
+ Use Destructuring Assignment with the Rest Parameter to Reassign Array
+ Elements
challengeType: 1
forumTopicId: 301218
---
-## Description
-
+# --description--
+
In some situations involving array destructuring, we might want to collect the rest of the elements into a separate array.
-The result is similar to Array.prototype.slice(), as shown below:
+
+The result is similar to `Array.prototype.slice()`, as shown below:
```js
const [a, b, ...arr] = [1, 2, 3, 4, 5, 7];
@@ -16,37 +19,45 @@ console.log(a, b); // 1, 2
console.log(arr); // [3, 4, 5, 7]
```
-Variables a and b take the first and second values from the array. After that, because of the rest parameter's presence, arr gets the rest of the values in the form of an array.
-The rest element only works correctly as the last variable in the list. As in, you cannot use the rest parameter to catch a subarray that leaves out the last element of the original array.
-
+Variables `a` and `b` take the first and second values from the array. After that, because of the rest parameter's presence, `arr` gets the rest of the values in the form of an array. The rest element only works correctly as the last variable in the list. As in, you cannot use the rest parameter to catch a subarray that leaves out the last element of the original array.
-## Instructions
-
-Use destructuring assignment with the rest parameter to perform an effective Array.prototype.slice() so that arr is a sub-array of the original array source with the first two elements omitted.
-
+# --instructions--
-## Tests
-
+Use destructuring assignment with the rest parameter to perform an effective `Array.prototype.slice()` so that `arr` is a sub-array of the original array `source` with the first two elements omitted.
-```yml
-tests:
- - text: arr should be [3,4,5,6,7,8,9,10]
- testString: assert(arr.every((v, i) => v === i + 3) && arr.length === 8);
- - text: source should be [1,2,3,4,5,6,7,8,9,10]
- testString: assert(source.every((v, i) => v === i + 1) && source.length === 10);
- - text: Array.slice() should not be used.
- testString: getUserInput => assert(!getUserInput('index').match(/slice/g));
- - text: Destructuring on list should be used.
- testString: assert(__helpers.removeWhiteSpace(code).match(/\[(([_$a-z]\w*)?,){1,}\.\.\.arr\]=list/i));
+# --hints--
+`arr` should be `[3,4,5,6,7,8,9,10]`
+
+```js
+assert(arr.every((v, i) => v === i + 3) && arr.length === 8);
```
-
+`source` should be `[1,2,3,4,5,6,7,8,9,10]`
-## Challenge Seed
-
+```js
+assert(source.every((v, i) => v === i + 1) && source.length === 10);
+```
-
+`Array.slice()` should not be used.
+
+```js
+(getUserInput) => assert(!getUserInput('index').match(/slice/g));
+```
+
+Destructuring on `list` should be used.
+
+```js
+assert(
+ __helpers
+ .removeWhiteSpace(code)
+ .match(/\[(([_$a-z]\w*)?,){1,}\.\.\.arr\]=list/i)
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
const source = [1,2,3,4,5,6,7,8,9,10];
@@ -57,17 +68,9 @@ function removeFirstTwo(list) {
return arr;
}
const arr = removeFirstTwo(source);
-
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const source = [1,2,3,4,5,6,7,8,9,10];
@@ -77,5 +80,3 @@ function removeFirstTwo(list) {
}
const arr = removeFirstTwo(source);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md
index 17df6e4ad0..6823824f69 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md
@@ -5,9 +5,9 @@ challengeType: 1
forumTopicId: 301219
---
-## Description
-
-Imagine a file called math_functions.js that contains several functions related to mathematical operations. One of them is stored in a variable, add, that takes in two numbers and returns their sum. You want to use this function in several different JavaScript files. In order to share it with these other files, you first need to export it.
+# --description--
+
+Imagine a file called `math_functions.js` that contains several functions related to mathematical operations. One of them is stored in a variable, `add`, that takes in two numbers and returns their sum. You want to use this function in several different JavaScript files. In order to share it with these other files, you first need to `export` it.
```js
export const add = (x, y) => {
@@ -31,29 +31,35 @@ When you export a variable or function, you can import it in another file and us
export { add, subtract };
```
-
+# --instructions--
-## Instructions
-
There are two string-related functions in the editor. Export both of them using the method of your choice.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should properly export uppercaseString.
- testString: assert(code.match(/(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g));
- - text: You should properly export lowercaseString.
- testString: assert(code.match(/(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g));
+You should properly export `uppercaseString`.
+
+```js
+assert(
+ code.match(
+ /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g
+ )
+);
```
-
+You should properly export `lowercaseString`.
-## Challenge Seed
-
-
-
-
-## Solution
-
+# --solutions--
```js
export const uppercaseString = (string) => {
@@ -80,5 +82,3 @@ export const lowercaseString = (string) => {
return string.toLowerCase()
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md
index 3ee55a99cb..1fd62e3a51 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.md
@@ -5,12 +5,15 @@ challengeType: 1
forumTopicId: 301220
---
-## Description
-
+# --description--
+
You can obtain values from an object and set the value of a property within an object.
+
These are classically called getters and setters.
+
Getter functions are meant to simply return (get) the value of an object's private variable to the user without the user directly accessing the private variable.
-Setter functions are meant to modify (set) the value of an object's private variable based on the value passed into the setter function. This change could involve calculations, or even overwriting the previous value completely.
+
+Setter functions are meant to modify (set) the value of an object's private variable based on the value passed into the setter function. This change could involve calculations, or even overwriting the previous value completely.
```js
class Book {
@@ -32,49 +35,106 @@ novel.writer = 'newAuthor';
console.log(novel.writer); // newAuthor
```
-Notice the syntax used to invoke the getter and setter. They do not even look like functions.
-Getters and setters are important because they hide internal implementation details.
-Note: It is convention to precede the name of a private variable with an underscore (_). However, the practice itself does not make a variable private.
-
+Notice the syntax used to invoke the getter and setter. They do not even look like functions. Getters and setters are important because they hide internal implementation details. **Note:** It is convention to precede the name of a private variable with an underscore (`_`). However, the practice itself does not make a variable private.
+
+# --instructions--
+
+Use the `class` keyword to create a Thermostat class. The constructor accepts a Fahrenheit temperature.
+
+In the class, create a `getter` to obtain the temperature in Celsius and a `setter` to set the temperature in Celsius.
+
+Remember that `C = 5/9 * (F - 32)` and `F = C * 9.0 / 5 + 32`, where `F` is the value of temperature in Fahrenheit, and `C` is the value of the same temperature in Celsius.
+
+**Note:** When you implement this, you will track the temperature inside the class in one scale, either Fahrenheit or Celsius.
-## Instructions
-
-Use the class keyword to create a Thermostat class. The constructor accepts a Fahrenheit temperature.
-In the class, create a getter to obtain the temperature in Celsius and a setter to set the temperature in Celsius.
-Remember that C = 5/9 * (F - 32) and F = C * 9.0 / 5 + 32, where F is the value of temperature in Fahrenheit, and C is the value of the same temperature in Celsius.
-Note: When you implement this, you will track the temperature inside the class in one scale, either Fahrenheit or Celsius.
This is the power of a getter and a setter. You are creating an API for another user, who can get the correct result regardless of which one you track.
+
In other words, you are abstracting implementation details from the user.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Thermostat should be a class with a defined constructor method.
- testString: assert(typeof Thermostat === 'function' && typeof Thermostat.constructor === 'function');
- - text: class keyword should be used.
- testString: assert(code.match(/class/g));
- - text: Thermostat should be able to be instantiated.
- testString: assert((() => {const t = new Thermostat(122);return typeof t === 'object'})());
- - text: When instantiated with a Fahrenheit value, Thermostat should set the correct temperature.
- testString: assert((() => {const t = new Thermostat(122);return t.temperature === 50})());
- - text: A getter should be defined.
- testString: assert((() => {const desc = Object.getOwnPropertyDescriptor(Thermostat.prototype, 'temperature');return !!desc && typeof desc.get === 'function';})());
- - text: A setter should be defined.
- testString: assert((() => {const desc = Object.getOwnPropertyDescriptor(Thermostat.prototype, 'temperature');return !!desc && typeof desc.set === 'function';})());
- - text: Calling the setter with a Celsius value should set the temperature.
- testString: assert((() => {const t = new Thermostat(32); t.temperature = 26; const u = new Thermostat(32); u.temperature = 50; return t.temperature === 26 && u.temperature === 50;})());
+`Thermostat` should be a `class` with a defined `constructor` method.
+```js
+assert(
+ typeof Thermostat === 'function' &&
+ typeof Thermostat.constructor === 'function'
+);
```
-
+`class` keyword should be used.
-## Challenge Seed
-
+```js
+assert(code.match(/class/g));
+```
-
+`Thermostat` should be able to be instantiated.
+
+```js
+assert(
+ (() => {
+ const t = new Thermostat(122);
+ return typeof t === 'object';
+ })()
+);
+```
+
+When instantiated with a Fahrenheit value, `Thermostat` should set the correct temperature.
+
+```js
+assert(
+ (() => {
+ const t = new Thermostat(122);
+ return t.temperature === 50;
+ })()
+);
+```
+
+A `getter` should be defined.
+
+```js
+assert(
+ (() => {
+ const desc = Object.getOwnPropertyDescriptor(
+ Thermostat.prototype,
+ 'temperature'
+ );
+ return !!desc && typeof desc.get === 'function';
+ })()
+);
+```
+
+A `setter` should be defined.
+
+```js
+assert(
+ (() => {
+ const desc = Object.getOwnPropertyDescriptor(
+ Thermostat.prototype,
+ 'temperature'
+ );
+ return !!desc && typeof desc.set === 'function';
+ })()
+);
+```
+
+Calling the `setter` with a Celsius value should set the temperature.
+
+```js
+assert(
+ (() => {
+ const t = new Thermostat(32);
+ t.temperature = 26;
+ const u = new Thermostat(32);
+ u.temperature = 50;
+ return t.temperature === 26 && u.temperature === 50;
+ })()
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Only change code below this line
@@ -87,14 +147,7 @@ thermos.temperature = 26;
temp = thermos.temperature; // 26 in Celsius
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
class Thermostat {
@@ -114,5 +167,3 @@ let temp = thermos.temperature; // 24.44 in Celsius
thermos.temperature = 26;
temp = thermos.temperature; // 26 in Celsius
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md
index 1dc09b8e9c..32e3e663e4 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 301221
---
-## Description
-
+# --description--
+
In order to help us create more flexible functions, ES6 introduces the rest parameter for function parameters. With the rest parameter, you can create functions that take a variable number of arguments. These arguments are stored in an array that can be accessed later from inside the function.
+
Check out this code:
```js
@@ -18,38 +19,47 @@ console.log(howMany(0, 1, 2)); // You have passed 3 arguments.
console.log(howMany("string", null, [1, 2, 3], { })); // You have passed 4 arguments.
```
-The rest parameter eliminates the need to check the args array and allows us to apply map(), filter() and reduce() on the parameters array.
-
+The rest parameter eliminates the need to check the `args` array and allows us to apply `map()`, `filter()` and `reduce()` on the parameters array.
-## Instructions
-
-Modify the function sum using the rest parameter in such a way that the function sum is able to take any number of arguments and return their sum.
-
+# --instructions--
-## Tests
-
+Modify the function `sum` using the rest parameter in such a way that the function `sum` is able to take any number of arguments and return their sum.
-```yml
-tests:
- - text: The result of sum(0,1,2) should be 3
- testString: assert(sum(0,1,2) === 3);
- - text: The result of sum(1,2,3,4) should be 10
- testString: assert(sum(1,2,3,4) === 10);
- - text: The result of sum(5) should be 5
- testString: assert(sum(5) === 5);
- - text: The result of sum() should be 0
- testString: assert(sum() === 0);
- - text: The sum function should use the ... rest parameter on the args parameter.
- testString: assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/));
+# --hints--
+The result of `sum(0,1,2)` should be 3
+
+```js
+assert(sum(0, 1, 2) === 3);
```
-
+The result of `sum(1,2,3,4)` should be 10
-## Challenge Seed
-
+```js
+assert(sum(1, 2, 3, 4) === 10);
+```
-
+The result of `sum(5)` should be 5
+
+```js
+assert(sum(5) === 5);
+```
+
+The result of `sum()` should be 0
+
+```js
+assert(sum() === 0);
+```
+
+The `sum` function should use the `...` rest parameter on the `args` parameter.
+
+```js
+assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/));
+```
+
+# --seed--
+
+## --seed-contents--
```js
const sum = (x, y, z) => {
@@ -58,19 +68,10 @@ const sum = (x, y, z) => {
}
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const sum = (...args) => {
return args.reduce((a, b) => a + b, 0);
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md
index ced4aeaf90..aab990a68b 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md
@@ -5,58 +5,60 @@ challengeType: 1
forumTopicId: 301222
---
-## Description
-
+# --description--
+
ES6 introduces the spread operator, which allows us to expand arrays and other expressions in places where multiple parameters or elements are expected.
-The ES5 code below uses apply() to compute the maximum value in an array:
+
+The ES5 code below uses `apply()` to compute the maximum value in an array:
```js
var arr = [6, 89, 3, 45];
var maximus = Math.max.apply(null, arr); // returns 89
```
-We had to use Math.max.apply(null, arr) because Math.max(arr) returns NaN. Math.max() expects comma-separated arguments, but not an array.
-The spread operator makes this syntax much better to read and maintain.
+We had to use `Math.max.apply(null, arr)` because `Math.max(arr)` returns `NaN`. `Math.max()` expects comma-separated arguments, but not an array. The spread operator makes this syntax much better to read and maintain.
```js
const arr = [6, 89, 3, 45];
const maximus = Math.max(...arr); // returns 89
```
-...arr returns an unpacked array. In other words, it spreads the array.
-However, the spread operator only works in-place, like in an argument to a function or in an array literal. The following code will not work:
+`...arr` returns an unpacked array. In other words, it *spreads* the array. However, the spread operator only works in-place, like in an argument to a function or in an array literal. The following code will not work:
```js
const spreaded = ...arr; // will throw a syntax error
```
-
+# --instructions--
-## Instructions
-
-Copy all contents of arr1 into another array arr2 using the spread operator.
-
+Copy all contents of `arr1` into another array `arr2` using the spread operator.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: arr2 should be correct copy of arr1.
- testString: assert(arr2.every((v, i) => v === arr1[i]) && arr2.length);
- - text: ... spread operator should be used to duplicate arr1.
- testString: assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/));
- - text: arr2 should remain unchanged when arr1 is changed.
- testString: assert((arr1, arr2) => {arr1.push('JUN'); return arr2.length < arr1.length});
+`arr2` should be correct copy of `arr1`.
+```js
+assert(arr2.every((v, i) => v === arr1[i]) && arr2.length);
```
-
+`...` spread operator should be used to duplicate `arr1`.
-## Challenge Seed
-
+```js
+assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/));
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
@@ -82,5 +77,3 @@ let arr2;
arr2 = [...arr1];
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md
index dfdd36289e..e81d509eef 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md
@@ -5,8 +5,8 @@ challengeType: 1
forumTopicId: 301223
---
-## Description
-
+# --description--
+
Just like a regular function, you can pass arguments into an arrow function.
```js
@@ -30,37 +30,48 @@ const multiplier = (item, multi) => item * multi;
multiplier(4, 2); // returns 8
```
-
+# --instructions--
-## Instructions
-
-Rewrite the myConcat function which appends contents of arr2 to arr1 so that the function uses arrow function syntax.
-
+Rewrite the `myConcat` function which appends contents of `arr2` to `arr1` so that the function uses arrow function syntax.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: You should replace the var keyword.
- testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- - text: myConcat should be a constant variable (by using const).
- testString: getUserInput => assert(getUserInput('index').match(/const\s+myConcat/g));
- - text: myConcat should be an arrow function with two parameters
- testString: assert(/myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && typeof myConcat === 'function');
- - text: myConcat() should return [1, 2, 3, 4, 5].
- testString: assert.deepEqual(myConcat([1, 2], [3, 4, 5]), [1, 2, 3, 4, 5]);
- - text: function keyword should not be used.
- testString: getUserInput => assert(!getUserInput('index').match(/function/g));
+You should replace the `var` keyword.
+```js
+(getUserInput) => assert(!getUserInput('index').match(/var/g));
```
-
+`myConcat` should be a constant variable (by using `const`).
-## Challenge Seed
-
+```js
+(getUserInput) => assert(getUserInput('index').match(/const\s+myConcat/g));
+```
-
+`myConcat` should be an arrow function with two parameters
+
+```js
+assert(
+ /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) &&
+ typeof myConcat === 'function'
+);
+```
+
+`myConcat()` should return `[1, 2, 3, 4, 5]`.
+
+```js
+assert.deepEqual(myConcat([1, 2], [3, 4, 5]), [1, 2, 3, 4, 5]);
+```
+
+`function` keyword should not be used.
+
+```js
+(getUserInput) => assert(!getUserInput('index').match(/function/g));
+```
+
+# --seed--
+
+## --seed-contents--
```js
var myConcat = function(arr1, arr2) {
@@ -70,14 +81,7 @@ var myConcat = function(arr1, arr2) {
console.log(myConcat([1, 2], [3, 4, 5]));
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const myConcat = (arr1, arr2) => {
@@ -86,5 +90,3 @@ const myConcat = (arr1, arr2) => {
console.log(myConcat([1, 2], [3, 4, 5]));
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md
index d7bda4a98d..c93e24d648 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md
@@ -5,9 +5,9 @@ challengeType: 1
forumTopicId: 301224
---
-## Description
-
-When defining functions within objects in ES5, we have to use the keyword function as follows:
+# --description--
+
+When defining functions within objects in ES5, we have to use the keyword `function` as follows:
```js
const person = {
@@ -18,7 +18,7 @@ const person = {
};
```
-With ES6, You can remove the function keyword and colon altogether when defining functions in objects. Here's an example of this syntax:
+With ES6, You can remove the `function` keyword and colon altogether when defining functions in objects. Here's an example of this syntax:
```js
const person = {
@@ -29,33 +29,35 @@ const person = {
};
```
-
+# --instructions--
-## Instructions
-
-Refactor the function setGear inside the object bicycle to use the shorthand syntax described above.
-
+Refactor the function `setGear` inside the object `bicycle` to use the shorthand syntax described above.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Traditional function expression should not be used.
- testString: getUserInput => assert(!__helpers.removeJSComments(code).match(/function/));
- - text: setGear should be a declarative function.
- testString: assert(typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/));
- - text: bicycle.setGear(48) should change the gear value to 48.
- testString: assert((new bicycle.setGear(48)).gear === 48);
+Traditional function expression should not be used.
+```js
+(getUserInput) => assert(!__helpers.removeJSComments(code).match(/function/));
```
-
+`setGear` should be a declarative function.
-## Challenge Seed
-
+```js
+assert(
+ typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/)
+);
+```
-
+`bicycle.setGear(48)` should change the `gear` value to 48.
+
+```js
+assert(new bicycle.setGear(48).gear === 48);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Only change code below this line
@@ -70,12 +72,7 @@ bicycle.setGear(3);
console.log(bicycle.gear);
```
-
-
-
-
-## Solution
-
+# --solutions--
```js
const bicycle = {
@@ -86,5 +83,3 @@ const bicycle = {
};
bicycle.setGear(3);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md
index 93c716aff9..b8041593dc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 301225
---
-## Description
-
+# --description--
+
ES6 adds some nice support for easily defining object literals.
+
Consider the following code:
```js
@@ -17,39 +18,36 @@ const getMousePosition = (x, y) => ({
});
```
-getMousePosition is a simple function that returns an object containing two properties.
-ES6 provides the syntactic sugar to eliminate the redundancy of having to write x: x. You can simply write x once, and it will be converted tox: x (or something equivalent) under the hood.
-Here is the same function from above rewritten to use this new syntax:
+`getMousePosition` is a simple function that returns an object containing two properties. ES6 provides the syntactic sugar to eliminate the redundancy of having to write `x: x`. You can simply write `x` once, and it will be converted to`x: x` (or something equivalent) under the hood. Here is the same function from above rewritten to use this new syntax:
```js
const getMousePosition = (x, y) => ({ x, y });
```
-
+# --instructions--
-## Instructions
-
-Use object property shorthand with object literals to create and return an object with name, age and gender properties.
-
+Use object property shorthand with object literals to create and return an object with `name`, `age` and `gender` properties.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: 'createPerson("Zodiac Hasbro", 56, "male") should return {name: "Zodiac Hasbro", age: 56, gender: "male"}.'
- testString: assert.deepEqual({name:"Zodiac Hasbro",age:56,gender:"male"}, createPerson("Zodiac Hasbro", 56, "male"));
- - text: Your code should not use key:value.
- testString: getUserInput => assert(!getUserInput('index').match(/:/g));
+`createPerson("Zodiac Hasbro", 56, "male")` should return `{name: "Zodiac Hasbro", age: 56, gender: "male"}`.
+```js
+assert.deepEqual(
+ { name: 'Zodiac Hasbro', age: 56, gender: 'male' },
+ createPerson('Zodiac Hasbro', 56, 'male')
+);
```
-
+Your code should not use `key:value`.
-## Challenge Seed
-
+```js
+(getUserInput) => assert(!getUserInput('index').match(/:/g));
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const createPerson = (name, age, gender) => {
@@ -81,5 +72,3 @@ const createPerson = (name, age, gender) => {
};
};
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-001.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-001.md
index cf1d2045af..bd6b34ed41 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-001.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-001.md
@@ -4,53 +4,25 @@ title: Part 1
challengeType: 0
---
-## Description
-
+# --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.
+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--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, "").includes("constinfixToFunction={}"));
+See description above for instructions.
+```js
+assert(code.replace(/\s/g, '').includes('constinfixToFunction={}'));
```
+# --seed--
-
-
-## Challenge Seed
-
-
-
+## --seed-contents--
+
+```html
+
+```
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-004.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-004.md
index b5dc418aca..062aacd90b 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-004.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-004.md
@@ -4,57 +4,23 @@ title: Part 4
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, "").includes("constaddVar=add"));
+See description above for instructions.
+```js
+assert(code.replace(/\s/g, '').includes('constaddVar=add'));
```
+# --seed--
-
-
-## Challenge Seed
-
-
-
+## --seed-contents--
+
+```html
+
+```
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-006.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-006.md
index 923a50a6c5..14cbc37541 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-006.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-006.md
@@ -4,8 +4,7 @@ title: Part 6
challengeType: 0
---
-## Description
-
+# --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:
@@ -17,52 +16,19 @@ const fn = function(x) {
fn();
```
-Assign the anonymous function to the variable `addVar`.
+Assign the anonymous function to the variable `addVar`.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, "").includes("constaddVar=function(x,y){returnx+y"));
+See description above for instructions.
+```js
+assert(code.replace(/\s/g, '').includes('constaddVar=function(x,y){returnx+y'));
```
+# --seed--
-
-
-## Challenge Seed
-
-
-
+## --seed-contents--
+
+```html
+
+```
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-007.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-007.md
index 8da5112e55..0ccb80a402 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-007.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-007.md
@@ -4,10 +4,9 @@ title: Part 7
challengeType: 0
---
-## Description
-
+# --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.
+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:
@@ -17,50 +16,17 @@ const fn = (x, y) => x;
Note that the value is returned implicitly.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, "").includes("constaddVar=(x,y)=>x+y"));
+See description above for instructions.
+```js
+assert(code.replace(/\s/g, '').includes('constaddVar=(x,y)=>x+y'));
```
+# --seed--
-
-
-## Challenge Seed
-
-
-
+## --seed-contents--
+
+```html
+
+```
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-013.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-013.md
index c06761202b..8cbbe0d41c 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-013.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-013.md
@@ -4,12 +4,11 @@ title: Part 13
challengeType: 0
---
-## Description
-
+# --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.
+Pass the `+` function from `infixToFunction` to the `replace` method as the second argument.
This is how you would pass the `-` function:
@@ -17,54 +16,17 @@ This is how you would pass the `-` function:
str.replace(regex, infixToFunction["-"])
```
+# --hints--
-
-
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(infixEval("ab", /(a)b/) === "aba");
+See description above for instructions.
+```js
+assert(infixEval('ab', /(a)b/) === 'aba');
```
+# --seed--
-
-
-## Challenge Seed
-
-
-
+## --seed-contents--
+
+```html
+
+```
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-017.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-017.md
index d0f6ad09eb..bae1122dde 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-017.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-017.md
@@ -4,8 +4,7 @@ title: Part 17
challengeType: 0
---
-## Description
-
+# --description--
The `match` parameter is currently unused, which can lead to unused variable warnings in some linters.
@@ -13,56 +12,17 @@ To fix this, prefix or replace it with an underscore (`_`) - both ways signal to
Note that a single underscore can only be used once in a function and may conflict with some libraries (Lodash, Underscore.js).
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, "").includes("str.replace(regex,(_"));
+See description above for instructions.
+```js
+assert(code.replace(/\s/g, '').includes('str.replace(regex,(_'));
```
+# --seed--
-
-
-## Challenge Seed
-
-
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-030.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-030.md
index cddabd1f3a..103c071e37 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-030.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-030.md
@@ -4,8 +4,7 @@ title: Part 30
challengeType: 0
---
-## Description
-
+# --description--
The `split` method returns an array of strings from a larger string by using its argument to determine where to make each split:
@@ -15,31 +14,52 @@ The `split` method returns an array of strings from a larger string by using its
Add a function `toNumberList` (inside `applyFn`) which takes an argument `args` and splits it by commas. Return `toNumberList`.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(JSON.stringify(applyFn("")("foo,baz,bar")) === '["foo","baz","bar"]');
+See description above for instructions.
+```js
+assert(JSON.stringify(applyFn('')('foo,baz,bar')) === '["foo","baz","bar"]');
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-031.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-031.md
index b518720484..a5b721c88f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-031.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-031.md
@@ -4,8 +4,7 @@ title: Part 31
challengeType: 0
---
-## Description
-
+# --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:
@@ -15,30 +14,56 @@ The `map` method takes a function and for each element of an array, it passes th
In `toNumberList`, chain the `map` method to `args.split(",")` and pass it `parseFloat` to parse each element of the array into a number.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, "").includes('consttoNumberList=args=>args.split(",").map(parseFloat)'));
+See description above for instructions.
+```js
+assert(
+ code
+ .replace(/\s/g, '')
+ .includes('consttoNumberList=args=>args.split(",").map(parseFloat)')
+);
```
-
+# --seed--
-## Challenge Seed
-
+## --before-user-code--
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-042.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-042.md
index a7e28c4e19..b0ce7a399f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-042.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-042.md
@@ -4,8 +4,7 @@ title: Part 42
challengeType: 0
---
-## Description
-
+# --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.
@@ -18,31 +17,56 @@ The `concat` method returns a new array instead of modifying an existing one:
Use `concat` instead of `push` to return the result of adding `end` to `arr`.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(JSON.stringify(range(1,2)) === "[1,2]" && code.includes("concat") && !(code.includes("push")));
+See description above for instructions.
+```js
+assert(
+ JSON.stringify(range(1, 2)) === '[1,2]' &&
+ code.includes('concat') &&
+ !code.includes('push')
+);
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-094.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-094.md
index 852a740d6b..8b7b2a71f4 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-094.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-094.md
@@ -4,38 +4,58 @@ title: Part 94
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, "").includes("console.log(value.slice(0,2))"));
+See description above for instructions.
+```js
+assert(code.replace(/\s/g, '').includes('console.log(value.slice(0,2))'));
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-095.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-095.md
index 8a5215c6aa..aabcafbe1d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-095.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-095.md
@@ -4,38 +4,58 @@ title: Part 95
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, "").includes("console.log(value.slice(1))"));
+See description above for instructions.
+```js
+assert(code.replace(/\s/g, '').includes('console.log(value.slice(1))'));
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-099.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-099.md
index 6281d3ba41..f9e657f1bf 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-099.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-099.md
@@ -4,8 +4,7 @@ title: Part 99
challengeType: 0
---
-## Description
-
+# --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.
@@ -17,31 +16,56 @@ 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--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(/(spreadsheetFunctions\[["']random["']\]\(1,1000\))===\1/.test(code.replace(/\s/g, "")));
+See description above for instructions.
+```js
+assert(
+ /(spreadsheetFunctions\[["']random["']\]\(1,1000\))===\1/.test(
+ code.replace(/\s/g, '')
+ )
+);
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-104.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-104.md
index e958a58742..d508acc212 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-104.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-104.md
@@ -4,40 +4,61 @@ title: Part 104
challengeType: 0
---
-## Description
-
+# --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.
+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--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: const nos = code.replace(/\s/g, ""); assert(nos.includes('elemValue=n=>c=>""') && nos.includes('match=>""'))
+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--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-116.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-116.md
index 7f3e4d5535..c7dca83212 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-116.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-116.md
@@ -4,8 +4,7 @@ title: Part 116
challengeType: 0
---
-## Description
-
+# --description--
You can also pass in a negative argument to `slice` to specify that index from the end:
@@ -15,31 +14,54 @@ You can also pass in a negative argument to `slice` to specify that index from t
Use a negative index to add a function `lasttwo` which returns the last two elements of an array.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(JSON.stringify(spreadsheetFunctions.lasttwo([2, 6, 1, 4, 3])) === "[4,3]");
+See description above for instructions.
+```js
+assert(
+ JSON.stringify(spreadsheetFunctions.lasttwo([2, 6, 1, 4, 3])) === '[4,3]'
+);
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-118.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-118.md
index 3e05c42ee3..a0e67bddd4 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-118.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-118.md
@@ -4,8 +4,7 @@ title: Part 118
challengeType: 0
---
-## Description
-
+# --description--
The `filter` method keeps only the elements of an array that satisfy the function passed to it:
@@ -15,31 +14,55 @@ The `filter` method keeps only the elements of an array that satisfy the functio
Use `filter` to add a function called `even` to `spreadsheetFunctions`, which returns all the even elements of an array, `nums`.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(JSON.stringify(spreadsheetFunctions.even([2,3,5,6,9,4])) === "[2,6,4]" && code.includes("filter"));
+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--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-119.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-119.md
index 49c6d83e25..aeb6c78e55 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-119.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-119.md
@@ -4,8 +4,7 @@ title: Part 119
challengeType: 0
---
-## Description
-
+# --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.
@@ -19,31 +18,54 @@ For example, here's how to multiply all the value in an array:
Using `reduce`, add a function `sum` to `spreadsheetFunctions`, which sums all values in the array passed to it.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(spreadsheetFunctions.sum([10,5,1,3]) === 19 && code.includes("reduce"));
+See description above for instructions.
+```js
+assert(
+ spreadsheetFunctions.sum([10, 5, 1, 3]) === 19 && code.includes('reduce')
+);
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-121.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-121.md
index 75704cc0d3..698b41192c 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-121.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-121.md
@@ -4,8 +4,7 @@ title: Part 121
challengeType: 0
---
-## Description
-
+# --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:
@@ -17,31 +16,56 @@ The `reduce` method can take a second argument (in addition to the function), sp
Add a function `nodups` to `spreadsheetFunctions`, with the value `arr => arr.reduce((a, x) => a.includes(x), [])`.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(/nodups['"]?:arr=>arr\.reduce\(\(a,x\)=>a\.includes\(x\),\[\]\)/.test(code.replace(/\s/g, "")))
+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--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-124.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-124.md
index a0dfc4334f..3b35dfb646 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-124.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-124.md
@@ -4,38 +4,58 @@ title: Part 124
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(/[{,]sum[,}]/.test(code.replace(/\s/g, "")));
+See description above for instructions.
+```js
+assert(/[{,]sum[,}]/.test(code.replace(/\s/g, '')));
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-130.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-130.md
index 54322c57b6..d764f65ad5 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-130.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-130.md
@@ -4,38 +4,62 @@ title: Part 130
challengeType: 0
---
-## Description
-
+# --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--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(/constmedian=nums=>\{constsorted=nums\.slice\(\)\.sort\(\((.+),(.+)\)=>\1-\2\)/.test(code.replace(/\s/g, "")));
+See description above for instructions.
+```js
+assert(
+ /constmedian=nums=>\{constsorted=nums\.slice\(\)\.sort\(\((.+),(.+)\)=>\1-\2\)/.test(
+ code.replace(/\s/g, '')
+ )
+);
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-137.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-137.md
index 6067f97f8d..29f78b83a6 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-137.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-137.md
@@ -4,8 +4,7 @@ title: Part 137
challengeType: 0
---
-## Description
-
+# --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.
@@ -13,31 +12,54 @@ While we don't expect the user to enter particularly large numbers so that perfo
Replace the body of `range` with `start`.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(/constrange=\(start,end\)=>start(;|const)/.test(code.replace(/\s/g, "")));
+See description above for instructions.
+```js
+assert(
+ /constrange=\(start,end\)=>start(;|const)/.test(code.replace(/\s/g, ''))
+);
```
+# --seed--
-
+## --before-user-code--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
-
-
-
-
-
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-140.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-140.md
index 3c0d24efbc..8ba5b229a4 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-140.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming-spreadsheet/part-140.md
@@ -4,8 +4,7 @@ title: Part 140
challengeType: 0
---
-## Description
-
+# --description--
The function in the `map` method can actually take a second argument: the index of the element.
@@ -13,31 +12,58 @@ This is why you need an arrow function in `charRange` - if you don't use one, th
Chain `.map((x, i) => x + i)` to `.fill(start)` to add its index to every element in the array in `range`.
-
+# --hints--
-## Instructions
-
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, "").includes("constrange=(start,end)=>Array(end-start+1).fill(start).map((x,i)=>x+i)"));
+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--
-## Challenge Seed
-
+```html
+
+
+
+
+ Spreadsheet
+
+
+
+
+## --seed-contents--
+
+```html
+
+```
+
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md
index d018f1db5c..e697a30b39 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md
@@ -5,10 +5,11 @@ challengeType: 1
forumTopicId: 301226
---
-## Description
-
+# --description--
+
Functional programming is all about creating and using non-mutating functions.
-The last challenge introduced the concat method as a way to combine arrays into a new one without mutating the original arrays. Compare concat to the push method. Push adds an item to the end of the same array it is called on, which mutates that array. Here's an example:
+
+The last challenge introduced the `concat` method as a way to combine arrays into a new one without mutating the original arrays. Compare `concat` to the `push` method. `Push` adds an item to the end of the same array it is called on, which mutates that array. Here's an example:
```js
var arr = [1, 2, 3];
@@ -17,38 +18,50 @@ arr.push([4, 5, 6]);
// Not the functional programming way
```
-Concat offers a way to add new items to the end of an array without any mutating side effects.
-
+`Concat` offers a way to add new items to the end of an array without any mutating side effects.
-## Instructions
-
-Change the nonMutatingPush function so it uses concat to add newItem to the end of original instead of push. The function should return an array.
-
+# --instructions--
-## Tests
-
+Change the `nonMutatingPush` function so it uses `concat` to add `newItem` to the end of `original` instead of `push`. The function should return an array.
-```yml
-tests:
- - text: Your code should use the concat method.
- testString: assert(code.match(/\.concat/g));
- - text: Your code should not use the push method.
- testString: assert(!code.match(/\.?[\s\S]*?push/g));
- - text: The first array should not change.
- testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
- - text: The second array should not change.
- testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
- - text: nonMutatingPush([1, 2, 3], [4, 5]) should return [1, 2, 3, 4, 5].
- testString: assert(JSON.stringify(nonMutatingPush([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
+# --hints--
+Your code should use the `concat` method.
+
+```js
+assert(code.match(/\.concat/g));
```
-
+Your code should not use the `push` method.
-## Challenge Seed
-
+```js
+assert(!code.match(/\.?[\s\S]*?push/g));
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function nonMutatingPush(original, newItem) {
@@ -79,5 +85,3 @@ var first = [1, 2, 3];
var second = [4, 5];
nonMutatingPush(first, second);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md
index 5d170d587d..c753ab6a82 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md
@@ -5,46 +5,64 @@ challengeType: 1
forumTopicId: 301227
---
-## Description
-
-The last several challenges covered a number of useful array and string methods that follow functional programming principles. We've also learned about reduce, which is a powerful method used to reduce problems to simpler forms. From computing averages to sorting, any array operation can be achieved by applying it. Recall that map and filter are special cases of reduce.
+# --description--
+
+The last several challenges covered a number of useful array and string methods that follow functional programming principles. We've also learned about `reduce`, which is a powerful method used to reduce problems to simpler forms. From computing averages to sorting, any array operation can be achieved by applying it. Recall that `map` and `filter` are special cases of `reduce`.
+
Let's combine what we've learned to solve a practical problem.
+
Many content management sites (CMS) have the titles of a post added to part of the URL for simple bookmarking purposes. For example, if you write a Medium post titled "Stop Using Reduce", it's likely the URL would have some form of the title string in it (".../stop-using-reduce"). You may have already noticed this on the freeCodeCamp site.
-
-## Instructions
-
-Fill in the urlSlug function so it converts a string title and returns the hyphenated version for the URL. You can use any of the methods covered in this section, and don't use replace. Here are the requirements:
+# --instructions--
+
+Fill in the `urlSlug` function so it converts a string `title` and returns the hyphenated version for the URL. You can use any of the methods covered in this section, and don't use `replace`. Here are the requirements:
+
The input is a string with spaces and title-cased words
-The output is a string with the spaces between words replaced by a hyphen (-)
+
+The output is a string with the spaces between words replaced by a hyphen (`-`)
+
The output should be all lower-cased letters
+
The output should not have any spaces
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should not use the replace method for this challenge.
- testString: assert(!code.match(/\.?[\s\S]*?replace/g));
- - text: urlSlug("Winter Is Coming") should return "winter-is-coming".
- testString: assert(urlSlug("Winter Is Coming") === "winter-is-coming");
- - text: urlSlug(" Winter Is Coming") should return "winter-is-coming".
- testString: assert(urlSlug(" Winter Is Coming") === "winter-is-coming");
- - text: urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") should return "a-mind-needs-books-like-a-sword-needs-a-whetstone".
- testString: assert(urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") === "a-mind-needs-books-like-a-sword-needs-a-whetstone");
- - text: urlSlug("Hold The Door") should return "hold-the-door".
- testString: assert(urlSlug("Hold The Door") === "hold-the-door");
+Your code should not use the `replace` method for this challenge.
+```js
+assert(!code.match(/\.?[\s\S]*?replace/g));
```
-
+`urlSlug("Winter Is Coming")` should return `"winter-is-coming"`.
-## Challenge Seed
-
+```js
+assert(urlSlug('Winter Is Coming') === 'winter-is-coming');
+```
-
+`urlSlug(" Winter Is Coming")` should return `"winter-is-coming"`.
+
+```js
+assert(urlSlug(' Winter Is Coming') === 'winter-is-coming');
+```
+
+`urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")` should return `"a-mind-needs-books-like-a-sword-needs-a-whetstone"`.
+
+```js
+assert(
+ urlSlug('A Mind Needs Books Like A Sword Needs A Whetstone') ===
+ 'a-mind-needs-books-like-a-sword-needs-a-whetstone'
+);
+```
+
+`urlSlug("Hold The Door")` should return `"hold-the-door"`.
+
+```js
+assert(urlSlug('Hold The Door') === 'hold-the-door');
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Only change code below this line
@@ -55,14 +73,7 @@ function urlSlug(title) {
// Only change code above this line
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
// Only change code below this line
@@ -70,5 +81,3 @@ function urlSlug(title) {
return title.trim().split(/\s+/).join("-").toLowerCase();
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md
index d93f95f435..ddf36ee4b3 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.md
@@ -5,47 +5,54 @@ challengeType: 1
forumTopicId: 301228
---
-## Description
-
-If you haven't already figured it out, the issue in the previous challenge was with the splice call in the tabClose() function. Unfortunately, splice changes the original array it is called on, so the second call to it used a modified array, and gave unexpected results.
+# --description--
+
+If you haven't already figured it out, the issue in the previous challenge was with the `splice` call in the `tabClose()` function. Unfortunately, `splice` changes the original array it is called on, so the second call to it used a modified array, and gave unexpected results.
+
This is a small example of a much larger pattern - you call a function on a variable, array, or an object, and the function changes the variable or something in the object.
+
One of the core principles of functional programming is to not change things. Changes lead to bugs. It's easier to prevent bugs knowing that your functions don't change anything, including the function arguments or any global variable.
-The previous example didn't have any complicated operations but the splice method changed the original array, and resulted in a bug.
+
+The previous example didn't have any complicated operations but the `splice` method changed the original array, and resulted in a bug.
+
Recall that in functional programming, changing or altering things is called mutation, and the outcome is called a side effect. A function, ideally, should be a pure function, meaning that it does not cause any side effects.
+
Let's try to master this discipline and not alter any variable or object in our code.
-
-## Instructions
-
-Fill in the code for the function incrementer so it returns the value of the global variable fixedValue increased by one.
-
+# --instructions--
-## Tests
-
+Fill in the code for the function `incrementer` so it returns the value of the global variable `fixedValue` increased by one.
-```yml
-tests:
- - text: Your function incrementer should not change the value of fixedValue (which is 4).
- testString: incrementer(); assert(fixedValue === 4);
- - text: Your incrementer function should return a value that is one larger than the fixedValue value.
- testString: const __newValue = incrementer(); assert(__newValue === 5);
- - text: Your incrementer function should return a value based on the global `fixedValue` variable value.
- testString: |
- (function() {
- fixedValue = 10;
- const newValue = incrementer();
- assert(fixedValue === 10 && newValue === 11);
- fixedValue = 4;
- })();
+# --hints--
+Your function `incrementer` should not change the value of `fixedValue` (which is `4`).
+
+```js
+incrementer();
+assert(fixedValue === 4);
```
-
+Your `incrementer` function should return a value that is one larger than the `fixedValue` value.
-## Challenge Seed
-
+```js
+const __newValue = incrementer();
+assert(__newValue === 5);
+```
-
+Your `incrementer` function should return a value based on the global `fixedValue` variable value.
+
+```js
+(function () {
+ fixedValue = 10;
+ const newValue = incrementer();
+ assert(fixedValue === 10 && newValue === 11);
+ fixedValue = 4;
+})();
+```
+
+# --seed--
+
+## --seed-contents--
```js
// The global variable
@@ -59,14 +66,7 @@ function incrementer () {
}
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
var fixedValue = 4
@@ -75,5 +75,3 @@ function incrementer() {
return fixedValue + 1
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md
index ee7afe2378..f34de83d20 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 18221
---
-## Description
-
-The join method is used to join the elements of an array together to create a string. It takes an argument for the delimiter that is used to separate the array elements in the string.
+# --description--
+
+The `join` method is used to join the elements of an array together to create a string. It takes an argument for the delimiter that is used to separate the array elements in the string.
+
Here's an example:
```js
@@ -16,39 +17,56 @@ var str = arr.join(" ");
// Sets str to "Hello World"
```
-
+# --instructions--
-## Instructions
-
-Use the join method (among others) inside the sentensify function to make a sentence from the words in the string str. The function should return a string. For example, "I-like-Star-Wars" would be converted to "I like Star Wars". For this challenge, do not use the replace method.
-
+Use the `join` method (among others) inside the `sentensify` function to make a sentence from the words in the string `str`. The function should return a string. For example, "I-like-Star-Wars" would be converted to "I like Star Wars". For this challenge, do not use the `replace` method.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should use the join method.
- testString: assert(code.match(/\.join/g));
- - text: Your code should not use the replace method.
- testString: assert(!code.match(/\.?[\s\S]*?replace/g));
- - text: sentensify("May-the-force-be-with-you") should return a string.
- testString: assert(typeof sentensify("May-the-force-be-with-you") === "string");
- - text: sentensify("May-the-force-be-with-you") should return "May the force be with you".
- testString: assert(sentensify("May-the-force-be-with-you") === "May the force be with you");
- - text: sentensify("The.force.is.strong.with.this.one") should return "The force is strong with this one".
- testString: assert(sentensify("The.force.is.strong.with.this.one") === "The force is strong with this one");
- - text: sentensify("There,has,been,an,awakening") should return "There has been an awakening".
- testString: assert(sentensify("There,has,been,an,awakening") === "There has been an awakening");
+Your code should use the `join` method.
+```js
+assert(code.match(/\.join/g));
```
-
+Your code should not use the `replace` method.
-## Challenge Seed
-
+```js
+assert(!code.match(/\.?[\s\S]*?replace/g));
+```
-
+`sentensify("May-the-force-be-with-you")` should return a string.
+
+```js
+assert(typeof sentensify('May-the-force-be-with-you') === 'string');
+```
+
+`sentensify("May-the-force-be-with-you")` should return `"May the force be with you"`.
+
+```js
+assert(sentensify('May-the-force-be-with-you') === 'May the force be with you');
+```
+
+`sentensify("The.force.is.strong.with.this.one")` should return `"The force is strong with this one"`.
+
+```js
+assert(
+ sentensify('The.force.is.strong.with.this.one') ===
+ 'The force is strong with this one'
+);
+```
+
+`sentensify("There,has,been,an,awakening")` should return `"There has been an awakening"`.
+
+```js
+assert(
+ sentensify('There,has,been,an,awakening') === 'There has been an awakening'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function sentensify(str) {
@@ -60,14 +78,7 @@ function sentensify(str) {
sentensify("May-the-force-be-with-you");
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function sentensify(str) {
@@ -76,5 +87,3 @@ function sentensify(str) {
// Only change code above this line
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md
index 3b4097d315..e10941a9c8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md
@@ -5,44 +5,51 @@ challengeType: 1
forumTopicId: 301229
---
-## Description
-
-Concatenation means to join items end to end. JavaScript offers the concat method for both strings and arrays that work in the same way. For arrays, the method is called on one, then another array is provided as the argument to concat, which is added to the end of the first array. It returns a new array and does not mutate either of the original arrays. Here's an example:
+# --description--
+
+Concatenation means to join items end to end. JavaScript offers the `concat` method for both strings and arrays that work in the same way. For arrays, the method is called on one, then another array is provided as the argument to `concat`, which is added to the end of the first array. It returns a new array and does not mutate either of the original arrays. Here's an example:
```js
[1, 2, 3].concat([4, 5, 6]);
// Returns a new array [1, 2, 3, 4, 5, 6]
```
-
+# --instructions--
-## Instructions
-
-Use the concat method in the nonMutatingConcat function to concatenate attach to the end of original. The function should return the concatenated array.
-
+Use the `concat` method in the `nonMutatingConcat` function to concatenate `attach` to the end of `original`. The function should return the concatenated array.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should use the concat method.
- testString: assert(code.match(/\.concat/g));
- - text: The first array should not change.
- testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
- - text: The second array should not change.
- testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
- - text: nonMutatingConcat([1, 2, 3], [4, 5]) should return [1, 2, 3, 4, 5].
- testString: assert(JSON.stringify(nonMutatingConcat([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
+Your code should use the `concat` method.
+```js
+assert(code.match(/\.concat/g));
```
-
+The `first` array should not change.
-## Challenge Seed
-
+```js
+assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function nonMutatingConcat(original, attach) {
@@ -75,5 +75,3 @@ var first = [1, 2, 3];
var second = [4, 5];
nonMutatingConcat(first, second);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md
index f8addb1572..766c2a5ae0 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md
@@ -5,39 +5,35 @@ challengeType: 1
forumTopicId: 301230
---
-## Description
+# --description--
-
-As you have seen from applying Array.prototype.map(), or simply map() earlier, the map method returns an array of the same length as the one it was called on. It also doesn't alter the original array, as long as its callback function doesn't.
-In other words, map is a pure function, and its output depends solely on its inputs. Plus, it takes another function as its argument.
-You might learn a lot about the map method if you implement your own version of it. It is recommended you use a for loop or Array.prototype.forEach().
-
+As you have seen from applying `Array.prototype.map()`, or simply `map()` earlier, the `map` method returns an array of the same length as the one it was called on. It also doesn't alter the original array, as long as its callback function doesn't.
-## Instructions
+In other words, `map` is a pure function, and its output depends solely on its inputs. Plus, it takes another function as its argument.
-
-Write your own Array.prototype.myMap(), which should behave exactly like Array.prototype.map(). You should not use the built-in map method. The Array instance can be accessed in the myMap method using this.
-
+You might learn a lot about the `map` method if you implement your own version of it. It is recommended you use a `for` loop or `Array.prototype.forEach()`.
-## Tests
+# --instructions--
-
+Write your own `Array.prototype.myMap()`, which should behave exactly like `Array.prototype.map()`. You should not use the built-in `map` method. The `Array` instance can be accessed in the `myMap` method using `this`.
-```yml
-tests:
- - text: new_s should equal [46, 130, 196, 10].
- testString: assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]));
- - text: Your code should not use the map method.
- testString: assert(!code.match(/\.?[\s\S]*?map/g));
+# --hints--
+
+`new_s` should equal `[46, 130, 196, 10]`.
+
+```js
+assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]));
```
-
+Your code should not use the `map` method.
-## Challenge Seed
+```js
+assert(!code.match(/\.?[\s\S]*?map/g));
+```
-
+# --seed--
-
+## --seed-contents--
```js
// The global variable
@@ -56,13 +52,7 @@ var new_s = s.myMap(function(item) {
});
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
// the global Array
@@ -82,5 +72,3 @@ var new_s = s.myMap(function(item) {
return item * 2;
});
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md
index 748c7b6e6c..601fa0a764 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md
@@ -5,37 +5,31 @@ challengeType: 1
forumTopicId: 301231
---
-## Description
+# --description--
-
-You might learn a lot about the filter method if you implement your own version of it. It is recommended you use a for loop or Array.prototype.forEach().
-
+You might learn a lot about the `filter` method if you implement your own version of it. It is recommended you use a `for` loop or `Array.prototype.forEach()`.
-## Instructions
+# --instructions--
-
-Write your own Array.prototype.myFilter(), which should behave exactly like Array.prototype.filter(). You should not use the built-in filter method. The Array instance can be accessed in the myFilter method using this.
-
+Write your own `Array.prototype.myFilter()`, which should behave exactly like `Array.prototype.filter()`. You should not use the built-in `filter` method. The `Array` instance can be accessed in the `myFilter` method using `this`.
-## Tests
+# --hints--
-
+`new_s` should equal `[23, 65, 5]`.
-```yml
-tests:
- - text: new_s should equal [23, 65, 5].
- testString: assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]));
- - text: Your code should not use the filter method.
- testString: assert(!code.match(/\.?[\s\S]*?filter/g));
+```js
+assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]));
```
-
+Your code should not use the `filter` method.
-## Challenge Seed
+```js
+assert(!code.match(/\.?[\s\S]*?filter/g));
+```
-
+# --seed--
-
+## --seed-contents--
```js
// The global variable
@@ -53,13 +47,7 @@ var new_s = s.myFilter(function(item) {
});
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
// the global Array
@@ -79,5 +67,3 @@ var new_s = s.myFilter(function(item) {
return item % 2 === 1;
});
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md
index 982c0efeb9..e198f03133 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md
@@ -5,10 +5,12 @@ challengeType: 1
forumTopicId: 301232
---
-## Description
-
+# --description--
+
The arity of a function is the number of arguments it requires. Currying a function means to convert a function of N arity into N functions of arity 1.
+
In other words, it restructures a function so it takes one argument, then returns another function that takes the next argument, and so on.
+
Here's an example:
```js
@@ -37,8 +39,7 @@ var funcForY = curried(1);
console.log(funcForY(2)); // Prints 3
```
-Similarly, partial application can be described as applying a few arguments to a function at a time and returning another function that is applied to more arguments.
-Here's an example:
+Similarly, partial application can be described as applying a few arguments to a function at a time and returning another function that is applied to more arguments. Here's an example:
```js
//Impartial function
@@ -49,35 +50,39 @@ var partialFn = impartial.bind(this, 1, 2);
partialFn(10); // Returns 13
```
-
+# --instructions--
-## Instructions
-
-Fill in the body of the add function so it uses currying to add parameters x, y, and z.
-
+Fill in the body of the `add` function so it uses currying to add parameters `x`, `y`, and `z`.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: add(10)(20)(30) should return 60.
- testString: assert(add(10)(20)(30) === 60);
- - text: add(1)(2)(3) should return 6.
- testString: assert(add(1)(2)(3) === 6);
- - text: add(11)(22)(33) should return 66.
- testString: assert(add(11)(22)(33) === 66);
- - text: Your code should include a final statement that returns x + y + z.
- testString: assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g));
+`add(10)(20)(30)` should return `60`.
+```js
+assert(add(10)(20)(30) === 60);
```
-
+`add(1)(2)(3)` should return `6`.
-## Challenge Seed
-
+```js
+assert(add(1)(2)(3) === 6);
+```
-
+`add(11)(22)(33)` should return `66`.
+
+```js
+assert(add(11)(22)(33) === 66);
+```
+
+Your code should include a final statement that returns `x + y + z`.
+
+```js
+assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g));
+```
+
+# --seed--
+
+## --seed-contents--
```js
function add(x) {
@@ -89,17 +94,8 @@ function add(x) {
add(10)(20)(30);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const add = x => y => z => x + y + z
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.md
index e6d21eaf71..4b9053cf6f 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.md
@@ -5,40 +5,43 @@ challengeType: 1
forumTopicId: 301233
---
-## Description
-
+# --description--
+
Functional programming is a style of programming where solutions are simple, isolated functions, without any side effects outside of the function scope.
-INPUT -> PROCESS -> OUTPUT
+
+`INPUT -> PROCESS -> OUTPUT`
+
Functional programming is about:
+
1) Isolated functions - there is no dependence on the state of the program, which includes global variables that are subject to change
+
2) Pure functions - the same input always gives the same output
+
3) Functions with limited side effects - any changes, or mutations, to the state of the program outside the function are carefully controlled
-
-## Instructions
-
+# --instructions--
+
The members of freeCodeCamp happen to love tea.
-In the code editor, the prepareTea and getTea functions are already defined for you. Call the getTea function to get 40 cups of tea for the team, and store them in the tea4TeamFCC variable.
-
-## Tests
-
+In the code editor, the `prepareTea` and `getTea` functions are already defined for you. Call the `getTea` function to get 40 cups of tea for the team, and store them in the `tea4TeamFCC` variable.
-```yml
-tests:
- - text: The tea4TeamFCC variable should hold 40 cups of tea for the team.
- testString: assert(tea4TeamFCC.length === 40);
- - text: The tea4TeamFCC variable should hold cups of green tea.
- testString: assert(tea4TeamFCC[0] === 'greenTea');
+# --hints--
+The `tea4TeamFCC` variable should hold 40 cups of tea for the team.
+
+```js
+assert(tea4TeamFCC.length === 40);
```
-
+The `tea4TeamFCC` variable should hold cups of green tea.
-## Challenge Seed
-
+```js
+assert(tea4TeamFCC[0] === 'greenTea');
+```
-
+# --seed--
+
+## --seed-contents--
```js
// Function that returns a string representing a cup of green tea
@@ -64,14 +67,7 @@ const tea4TeamFCC = null;
// Only change code above this line
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const prepareTea = () => 'greenTea';
@@ -89,5 +85,3 @@ const getTea = (numOfCups) => {
const tea4TeamFCC = getTea(40);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md
index f2c587793f..fb907510d8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.md
@@ -5,43 +5,50 @@ challengeType: 1
forumTopicId: 301234
---
-## Description
-
+# --description--
+
The last challenge was a step closer to functional programming principles, but there is still something missing.
-We didn't alter the global variable value, but the function incrementer would not work without the global variable fixedValue being there.
+
+We didn't alter the global variable value, but the function `incrementer` would not work without the global variable `fixedValue` being there.
+
Another principle of functional programming is to always declare your dependencies explicitly. This means if a function depends on a variable or object being present, then pass that variable or object directly into the function as an argument.
+
There are several good consequences from this principle. The function is easier to test, you know exactly what input it takes, and it won't depend on anything else in your program.
+
This can give you more confidence when you alter, remove, or add new code. You would know what you can or cannot change and you can see where the potential traps are.
+
Finally, the function would always produce the same output for the same set of inputs, no matter what part of the code executes it.
-
-## Instructions
-
-Let's update the incrementer function to clearly declare its dependencies.
-Write the incrementer function so it takes an argument, and then returns a result after increasing the value by one.
-
+# --instructions--
-## Tests
-
+Let's update the `incrementer` function to clearly declare its dependencies.
-```yml
-tests:
- - text: Your function incrementer should not change the value of fixedValue (which is 4).
- testString: assert(fixedValue === 4);
- - text: Your incrementer function should take an argument.
- testString: assert(incrementer.length === 1);
- - text: Your incrementer function should return a value that is one larger than the fixedValue value.
- testString: const __newValue = incrementer(fixedValue); assert(__newValue === 5);
+Write the `incrementer` function so it takes an argument, and then returns a result after increasing the value by one.
+# --hints--
+Your function `incrementer` should not change the value of `fixedValue` (which is `4`).
+
+```js
+assert(fixedValue === 4);
```
-
+Your `incrementer` function should take an argument.
-## Challenge Seed
-
+```js
+assert(incrementer.length === 1);
+```
-
+Your `incrementer` function should return a value that is one larger than the `fixedValue` value.
+
+```js
+const __newValue = incrementer(fixedValue);
+assert(__newValue === 5);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// The global variable
@@ -55,14 +62,7 @@ function incrementer () {
}
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
// The global variable
@@ -77,5 +77,3 @@ function incrementer (fixedValue) {
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md
index c191ce5d59..f1657a42be 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md
@@ -5,44 +5,83 @@ challengeType: 1
forumTopicId: 301235
---
-## Description
-
+# --description--
+
So far, we have seen two distinct principles for functional programming:
-1) Don't alter a variable or object - create new variables and objects and return them if need be from a function. Hint: using something like var newArr = arrVar, where arrVar is an array will simply create a reference to the existing variable and not a copy. So changing a value in newArr would change the value in arrVar.
+
+1) Don't alter a variable or object - create new variables and objects and return them if need be from a function. Hint: using something like `var newArr = arrVar`, where `arrVar` is an array will simply create a reference to the existing variable and not a copy. So changing a value in `newArr` would change the value in `arrVar`.
+
2) Declare function parameters - any computation inside a function depends only on the arguments passed to the function, and not on any global object or variable.
+
Adding one to a number is not very exciting, but we can apply these principles when working with arrays or more complex objects.
-
-## Instructions
-
-Rewrite the code so the global array bookList is not changed inside either function. The add function should add the given bookName to the end of the array passed to it and return a new array (list). The remove function should remove the given bookName from the array passed to it.
+# --instructions--
-Note: Both functions should return an array, and any new parameters should be added before the bookName parameter.
+Rewrite the code so the global array `bookList` is not changed inside either function. The `add` function should add the given `bookName` to the end of the array passed to it and return a new array (list). The `remove` function should remove the given `bookName` from the array passed to it.
-
+**Note:** Both functions should return an array, and any new parameters should be added before the `bookName` parameter.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: bookList should not change and still equal ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"].
- testString: assert(JSON.stringify(bookList) === JSON.stringify(["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]));
- - text: newBookList should equal ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"].
- testString: assert(JSON.stringify(newBookList) === JSON.stringify(['The Hound of the Baskervilles', 'On The Electrodynamics of Moving Bodies', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae', 'A Brief History of Time']));
- - text: newerBookList should equal ["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"].
- testString: assert(JSON.stringify(newerBookList) === JSON.stringify(['The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae']));
- - text: newestBookList should equal ["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"].
- testString: assert(JSON.stringify(newestBookList) === JSON.stringify(['The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae', 'A Brief History of Time']));
+`bookList` should not change and still equal `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`.
+```js
+assert(
+ JSON.stringify(bookList) ===
+ JSON.stringify([
+ 'The Hound of the Baskervilles',
+ 'On The Electrodynamics of Moving Bodies',
+ 'Philosophiæ Naturalis Principia Mathematica',
+ 'Disquisitiones Arithmeticae'
+ ])
+);
```
-
+`newBookList` should equal `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`.
-## Challenge Seed
-
+```js
+assert(
+ JSON.stringify(newBookList) ===
+ JSON.stringify([
+ 'The Hound of the Baskervilles',
+ 'On The Electrodynamics of Moving Bodies',
+ 'Philosophiæ Naturalis Principia Mathematica',
+ 'Disquisitiones Arithmeticae',
+ 'A Brief History of Time'
+ ])
+);
+```
-
+`newerBookList` should equal `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`.
+
+```js
+assert(
+ JSON.stringify(newerBookList) ===
+ JSON.stringify([
+ 'The Hound of the Baskervilles',
+ 'Philosophiæ Naturalis Principia Mathematica',
+ 'Disquisitiones Arithmeticae'
+ ])
+);
+```
+
+`newestBookList` should equal `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`.
+
+```js
+assert(
+ JSON.stringify(newestBookList) ===
+ JSON.stringify([
+ 'The Hound of the Baskervilles',
+ 'Philosophiæ Naturalis Principia Mathematica',
+ 'Disquisitiones Arithmeticae',
+ 'A Brief History of Time'
+ ])
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// The global variable
@@ -76,14 +115,7 @@ var newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The El
console.log(bookList);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
// The global variable
@@ -106,5 +138,3 @@ var newBookList = add(bookList, 'A Brief History of Time');
var newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
var newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md
index d3b5e3ffd1..ade040d66d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md
@@ -5,9 +5,9 @@ challengeType: 1
forumTopicId: 301236
---
-## Description
-
-A common pattern while working with arrays is when you want to remove items and keep the rest of the array. JavaScript offers the splice method for this, which takes arguments for the index of where to start removing items, then the number of items to remove. If the second argument is not provided, the default is to remove items through the end. However, the splice method mutates the original array it is called on. Here's an example:
+# --description--
+
+A common pattern while working with arrays is when you want to remove items and keep the rest of the array. JavaScript offers the `splice` method for this, which takes arguments for the index of where to start removing items, then the number of items to remove. If the second argument is not provided, the default is to remove items through the end. However, the `splice` method mutates the original array it is called on. Here's an example:
```js
var cities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
@@ -15,37 +15,50 @@ cities.splice(3, 1); // Returns "London" and deletes it from the cities array
// cities is now ["Chicago", "Delhi", "Islamabad", "Berlin"]
```
-As we saw in the last challenge, the slice method does not mutate the original array, but returns a new one which can be saved into a variable. Recall that the slice method takes two arguments for the indices to begin and end the slice (the end is non-inclusive), and returns those items in a new array. Using the slice method instead of splice helps to avoid any array-mutating side effects.
-
+As we saw in the last challenge, the `slice` method does not mutate the original array, but returns a new one which can be saved into a variable. Recall that the `slice` method takes two arguments for the indices to begin and end the slice (the end is non-inclusive), and returns those items in a new array. Using the `slice` method instead of `splice` helps to avoid any array-mutating side effects.
+
+# --instructions--
+
+Rewrite the function `nonMutatingSplice` by using `slice` instead of `splice`. It should limit the provided `cities` array to a length of 3, and return a new array with only the first three items.
-## Instructions
-
-Rewrite the function nonMutatingSplice by using slice instead of splice. It should limit the provided cities array to a length of 3, and return a new array with only the first three items.
Do not mutate the original array provided to the function.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should use the slice method.
- testString: assert(code.match(/\.slice/g));
- - text: Your code should not use the splice method.
- testString: assert(!code.match(/\.?[\s\S]*?splice/g));
- - text: The inputCities array should not change.
- testString: assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]));
- - text: nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]) should return ["Chicago", "Delhi", "Islamabad"].
- testString: assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]));
+Your code should use the `slice` method.
+```js
+assert(code.match(/\.slice/g));
```
-
+Your code should not use the `splice` method.
-## Challenge Seed
-
+```js
+assert(!code.match(/\.?[\s\S]*?splice/g));
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function nonMutatingSplice(cities) {
@@ -76,5 +82,3 @@ function nonMutatingSplice(cities) {
var inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"];
nonMutatingSplice(inputCities);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md
index cab7bcca44..5ded09a85e 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md
@@ -5,40 +5,52 @@ challengeType: 1
forumTopicId: 301237
---
-## Description
-
-A side effect of the sort method is that it changes the order of the elements in the original array. In other words, it mutates the array in place. One way to avoid this is to first concatenate an empty array to the one being sorted (remember that slice and concat return a new array), then run the sort method.
-
+# --description--
-## Instructions
-
-Use the sort method in the nonMutatingSort function to sort the elements of an array in ascending order. The function should return a new array, and not mutate the globalArray variable.
-
+A side effect of the `sort` method is that it changes the order of the elements in the original array. In other words, it mutates the array in place. One way to avoid this is to first concatenate an empty array to the one being sorted (remember that `slice` and `concat` return a new array), then run the `sort` method.
-## Tests
-
+# --instructions--
-```yml
-tests:
- - text: Your code should use the sort method.
- testString: assert(nonMutatingSort.toString().match(/\.sort/g));
- - text: The globalArray variable should not change.
- testString: assert(JSON.stringify(globalArray) === JSON.stringify([5, 6, 3, 2, 9]));
- - text: nonMutatingSort(globalArray) should return [2, 3, 5, 6, 9].
- testString: assert(JSON.stringify(nonMutatingSort(globalArray)) === JSON.stringify([2, 3, 5, 6, 9]));
- - text: nonMutatingSort(globalArray) should not be hard coded.
- testString: assert(!nonMutatingSort.toString().match(/[23569]/g));
- - text: The function should return a new array, not the array passed to it.
- testString: assert(nonMutatingSort(globalArray) !== globalArray);
+Use the `sort` method in the `nonMutatingSort` function to sort the elements of an array in ascending order. The function should return a new array, and not mutate the `globalArray` variable.
+# --hints--
+
+Your code should use the `sort` method.
+
+```js
+assert(nonMutatingSort.toString().match(/\.sort/g));
```
-
+The `globalArray` variable should not change.
-## Challenge Seed
-
+```js
+assert(JSON.stringify(globalArray) === JSON.stringify([5, 6, 3, 2, 9]));
+```
-
+`nonMutatingSort(globalArray)` should return `[2, 3, 5, 6, 9]`.
+
+```js
+assert(
+ JSON.stringify(nonMutatingSort(globalArray)) ===
+ JSON.stringify([2, 3, 5, 6, 9])
+);
+```
+
+`nonMutatingSort(globalArray)` should not be hard coded.
+
+```js
+assert(!nonMutatingSort.toString().match(/[23569]/g));
+```
+
+The function should return a new array, not the array passed to it.
+
+```js
+assert(nonMutatingSort(globalArray) !== globalArray);
+```
+
+# --seed--
+
+## --seed-contents--
```js
var globalArray = [5, 6, 3, 2, 9];
@@ -51,14 +63,7 @@ function nonMutatingSort(arr) {
nonMutatingSort(globalArray);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
var globalArray = [5, 6, 3, 2, 9];
@@ -69,5 +74,3 @@ function nonMutatingSort(arr) {
}
nonMutatingSort(globalArray);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md
index 15dfdca834..8d4ebb7c25 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 301239
---
-## Description
-
-The slice method returns a copy of certain elements of an array. It can take two arguments, the first gives the index of where to begin the slice, the second is the index for where to end the slice (and it's non-inclusive). If the arguments are not provided, the default is to start at the beginning of the array through the end, which is an easy way to make a copy of the entire array. The slice method does not mutate the original array, but returns a new one.
+# --description--
+
+The `slice` method returns a copy of certain elements of an array. It can take two arguments, the first gives the index of where to begin the slice, the second is the index for where to end the slice (and it's non-inclusive). If the arguments are not provided, the default is to start at the beginning of the array through the end, which is an easy way to make a copy of the entire array. The `slice` method does not mutate the original array, but returns a new one.
+
Here's an example:
```js
@@ -16,37 +17,57 @@ var newArray = arr.slice(1, 3);
// Sets newArray to ["Dog", "Tiger"]
```
-
+# --instructions--
-## Instructions
-
-Use the slice method in the sliceArray function to return part of the anim array given the provided beginSlice and endSlice indices. The function should return an array.
-
+Use the `slice` method in the `sliceArray` function to return part of the `anim` array given the provided `beginSlice` and `endSlice` indices. The function should return an array.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should use the slice method.
- testString: assert(code.match(/\.slice/g));
- - text: The inputAnim variable should not change.
- testString: assert(JSON.stringify(inputAnim) === JSON.stringify(["Cat", "Dog", "Tiger", "Zebra", "Ant"]));
- - text: sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3) should return ["Dog", "Tiger"].
- testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)) === JSON.stringify(["Dog", "Tiger"]));
- - text: sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1) should return ["Cat"].
- testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)) === JSON.stringify(["Cat"]));
- - text: sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4) should return ["Dog", "Tiger", "Zebra"].
- testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)) === JSON.stringify(["Dog", "Tiger", "Zebra"]));
+Your code should use the `slice` method.
+```js
+assert(code.match(/\.slice/g));
```
-
+The `inputAnim` variable should not change.
-## Challenge Seed
-
+```js
+assert(
+ JSON.stringify(inputAnim) ===
+ JSON.stringify(['Cat', 'Dog', 'Tiger', 'Zebra', 'Ant'])
+);
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function sliceArray(anim, beginSlice, endSlice) {
@@ -77,5 +91,3 @@ function sliceArray(anim, beginSlice, endSlice) {
var inputAnim = ["Cat", "Dog", "Tiger", "Zebra", "Ant"];
sliceArray(inputAnim, 1, 3);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md
index afc7cf3743..06629ff149 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 18303
---
-## Description
-
-The sort method sorts the elements of an array according to the callback function.
+# --description--
+
+The `sort` method sorts the elements of an array according to the callback function.
+
For example:
```js
@@ -28,40 +29,50 @@ reverseAlpha(['l', 'h', 'z', 'b', 's']);
// Returns ['z', 's', 'l', 'h', 'b']
```
-JavaScript's default sorting method is by string Unicode point value, which may return unexpected results. Therefore, it is encouraged to provide a callback function to specify how to sort the array items. When such a callback function, normally called compareFunction, is supplied, the array elements are sorted according to the return value of the compareFunction:
-If compareFunction(a,b) returns a value less than 0 for two elements a and b, then a will come before b.
-If compareFunction(a,b) returns a value greater than 0 for two elements a and b, then b will come before a.
-If compareFunction(a,b) returns a value equal to 0 for two elements a and b, then a and b will remain unchanged.
+JavaScript's default sorting method is by string Unicode point value, which may return unexpected results. Therefore, it is encouraged to provide a callback function to specify how to sort the array items. When such a callback function, normally called `compareFunction`, is supplied, the array elements are sorted according to the return value of the `compareFunction`: If `compareFunction(a,b)` returns a value less than 0 for two elements `a` and `b`, then `a` will come before `b`. If `compareFunction(a,b)` returns a value greater than 0 for two elements `a` and `b`, then `b` will come before `a`. If `compareFunction(a,b)` returns a value equal to 0 for two elements `a` and `b`, then `a` and `b` will remain unchanged.
-
+# --instructions--
-## Instructions
-
-Use the sort method in the alphabeticalOrder function to sort the elements of arr in alphabetical order.
-
+Use the `sort` method in the `alphabeticalOrder` function to sort the elements of `arr` in alphabetical order.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should use the sort method.
- testString: assert(code.match(/\.sort/g));
- - text: alphabeticalOrder(["a", "d", "c", "a", "z", "g"]) should return ["a", "a", "c", "d", "g", "z"].
- testString: assert(JSON.stringify(alphabeticalOrder(["a", "d", "c", "a", "z", "g"])) === JSON.stringify(["a", "a", "c", "d", "g", "z"]));
- - text: alphabeticalOrder(["x", "h", "a", "m", "n", "m"]) should return ["a", "h", "m", "m", "n", "x"].
- testString: assert(JSON.stringify(alphabeticalOrder(["x", "h", "a", "m", "n", "m"])) === JSON.stringify(["a", "h", "m", "m", "n", "x"]));
- - text: alphabeticalOrder(["a", "a", "a", "a", "x", "t"]) should return ["a", "a", "a", "a", "t", "x"].
- testString: assert(JSON.stringify(alphabeticalOrder(["a", "a", "a", "a", "x", "t"])) === JSON.stringify(["a", "a", "a", "a", "t", "x"]));
+Your code should use the `sort` method.
+```js
+assert(code.match(/\.sort/g));
```
-
+`alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` should return `["a", "a", "c", "d", "g", "z"]`.
-## Challenge Seed
-
+```js
+assert(
+ JSON.stringify(alphabeticalOrder(['a', 'd', 'c', 'a', 'z', 'g'])) ===
+ JSON.stringify(['a', 'a', 'c', 'd', 'g', 'z'])
+);
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function alphabeticalOrder(arr) {
@@ -90,5 +94,3 @@ function alphabeticalOrder(arr) {
}
alphabeticalOrder(["a", "d", "c", "a", "z", "g"]);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md
index 3d7f20da6a..57e05a0b36 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md
@@ -5,9 +5,10 @@ challengeType: 1
forumTopicId: 18305
---
-## Description
-
-The split method splits a string into an array of strings. It takes an argument for the delimiter, which can be a character to use to break up the string or a regular expression. For example, if the delimiter is a space, you get an array of words, and if the delimiter is an empty string, you get an array of each character in the string.
+# --description--
+
+The `split` method splits a string into an array of strings. It takes an argument for the delimiter, which can be a character to use to break up the string or a regular expression. For example, if the delimiter is a space, you get an array of words, and if the delimiter is an empty string, you get an array of each character in the string.
+
Here are two examples that split one string by spaces, then another by digits using a regular expression:
```js
@@ -20,36 +21,50 @@ var byDigits = otherString.split(/\d/);
// Sets byDigits to ["How", "are", "you", "today"]
```
-Since strings are immutable, the split method makes it easier to work with them.
-
+Since strings are immutable, the `split` method makes it easier to work with them.
-## Instructions
-
-Use the split method inside the splitify function to split str into an array of words. The function should return the array. Note that the words are not always separated by spaces, and the array should not contain punctuation.
-
+# --instructions--
-## Tests
-
+Use the `split` method inside the `splitify` function to split `str` into an array of words. The function should return the array. Note that the words are not always separated by spaces, and the array should not contain punctuation.
-```yml
-tests:
- - text: Your code should use the split method.
- testString: assert(code.match(/\.split/g));
- - text: splitify("Hello World,I-am code") should return ["Hello", "World", "I", "am", "code"].
- testString: assert(JSON.stringify(splitify("Hello World,I-am code")) === JSON.stringify(["Hello", "World", "I", "am", "code"]));
- - text: splitify("Earth-is-our home") should return ["Earth", "is", "our", "home"].
- testString: assert(JSON.stringify(splitify("Earth-is-our home")) === JSON.stringify(["Earth", "is", "our", "home"]));
- - text: splitify("This.is.a-sentence") should return ["This", "is", "a", "sentence"].
- testString: assert(JSON.stringify(splitify("This.is.a-sentence")) === JSON.stringify(["This", "is", "a", "sentence"]));
+# --hints--
+Your code should use the `split` method.
+
+```js
+assert(code.match(/\.split/g));
```
-
+`splitify("Hello World,I-am code")` should return `["Hello", "World", "I", "am", "code"]`.
-## Challenge Seed
-
+```js
+assert(
+ JSON.stringify(splitify('Hello World,I-am code')) ===
+ JSON.stringify(['Hello', 'World', 'I', 'am', 'code'])
+);
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function splitify(str) {
@@ -77,5 +85,3 @@ function splitify(str) {
// Only change code above this line
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/understand-functional-programming-terminology.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/understand-functional-programming-terminology.md
index 40d1721a40..2a9e3e93c1 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/understand-functional-programming-terminology.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/understand-functional-programming-terminology.md
@@ -5,45 +5,57 @@ challengeType: 1
forumTopicId: 301240
---
-## Description
-
+# --description--
+
The FCC Team had a mood swing and now wants two types of tea: green tea and black tea. General Fact: Client mood swings are pretty common.
-With that information, we'll need to revisit the getTea function from last challenge to handle various tea requests. We can modify getTea to accept a function as a parameter to be able to change the type of tea it prepares. This makes getTea more flexible, and gives the programmer more control when client requests change.
+
+With that information, we'll need to revisit the `getTea` function from last challenge to handle various tea requests. We can modify `getTea` to accept a function as a parameter to be able to change the type of tea it prepares. This makes `getTea` more flexible, and gives the programmer more control when client requests change.
+
But first, let's cover some functional terminology:
-Callbacks are the functions that are slipped or passed into another function to decide the invocation of that function. You may have seen them passed to other methods, for example in filter, the callback function tells JavaScript the criteria for how to filter an array.
+
+Callbacks are the functions that are slipped or passed into another function to decide the invocation of that function. You may have seen them passed to other methods, for example in `filter`, the callback function tells JavaScript the criteria for how to filter an array.
+
Functions that can be assigned to a variable, passed into another function, or returned from another function just like any other normal value, are called first class functions. In JavaScript, all functions are first class functions.
+
The functions that take a function as an argument, or return a function as a return value are called higher order functions.
+
When the functions are passed in to another function or returned from another function, then those functions which gets passed in or returned can be called a lambda.
-
-## Instructions
-
-Prepare 27 cups of green tea and 13 cups of black tea and store them in tea4GreenTeamFCC and tea4BlackTeamFCC variables, respectively. Note that the getTea function has been modified so it now takes a function as the first argument.
+# --instructions--
+
+Prepare 27 cups of green tea and 13 cups of black tea and store them in `tea4GreenTeamFCC` and `tea4BlackTeamFCC` variables, respectively. Note that the `getTea` function has been modified so it now takes a function as the first argument.
+
Note: The data (the number of cups of tea) is supplied as the last argument. We'll discuss this more in later lessons.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: The tea4GreenTeamFCC variable should hold 27 cups of green tea for the team.
- testString: assert(tea4GreenTeamFCC.length === 27);
- - text: The tea4GreenTeamFCC variable should hold cups of green tea.
- testString: assert(tea4GreenTeamFCC[0] === 'greenTea');
- - text: The tea4BlackTeamFCC variable should hold 13 cups of black tea.
- testString: assert(tea4BlackTeamFCC.length === 13);
- - text: The tea4BlackTeamFCC variable should hold cups of black tea.
- testString: assert(tea4BlackTeamFCC[0] === 'blackTea');
+The `tea4GreenTeamFCC` variable should hold 27 cups of green tea for the team.
+```js
+assert(tea4GreenTeamFCC.length === 27);
```
-
+The `tea4GreenTeamFCC` variable should hold cups of green tea.
-## Challenge Seed
-
+```js
+assert(tea4GreenTeamFCC[0] === 'greenTea');
+```
-
+The `tea4BlackTeamFCC` variable should hold 13 cups of black tea.
+
+```js
+assert(tea4BlackTeamFCC.length === 13);
+```
+
+The `tea4BlackTeamFCC` variable should hold cups of black tea.
+
+```js
+assert(tea4BlackTeamFCC[0] === 'blackTea');
+```
+
+# --seed--
+
+## --seed-contents--
```js
// Function that returns a string representing a cup of green tea
@@ -78,14 +90,7 @@ console.log(
);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
const prepareGreenTea = () => 'greenTea';
@@ -104,5 +109,3 @@ const getTea = (prepareTea, numOfCups) => {
const tea4BlackTeamFCC = getTea(prepareBlackTea, 13);
const tea4GreenTeamFCC = getTea(prepareGreenTea, 27);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md
index 1b484dc4e2..5f375cf855 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.md
@@ -5,44 +5,56 @@ challengeType: 1
forumTopicId: 301241
---
-## Description
-
+# --description--
+
Functional programming is a good habit. It keeps your code easy to manage, and saves you from sneaky bugs. But before we get there, let's look at an imperative approach to programming to highlight where you may have issues.
+
In English (and many other languages), the imperative tense is used to give commands. Similarly, an imperative style in programming is one that gives the computer a set of statements to perform a task.
-Often the statements change the state of the program, like updating global variables. A classic example is writing a for loop that gives exact directions to iterate over the indices of an array.
+
+Often the statements change the state of the program, like updating global variables. A classic example is writing a `for` loop that gives exact directions to iterate over the indices of an array.
+
In contrast, functional programming is a form of declarative programming. You tell the computer what you want done by calling a method or function.
-JavaScript offers many predefined methods that handle common tasks so you don't need to write out how the computer should perform them. For example, instead of using the for loop mentioned above, you could call the map method which handles the details of iterating over an array. This helps to avoid semantic errors, like the "Off By One Errors" that were covered in the Debugging section.
+
+JavaScript offers many predefined methods that handle common tasks so you don't need to write out how the computer should perform them. For example, instead of using the `for` loop mentioned above, you could call the `map` method which handles the details of iterating over an array. This helps to avoid semantic errors, like the "Off By One Errors" that were covered in the Debugging section.
+
Consider the scenario: you are browsing the web in your browser, and want to track the tabs you have opened. Let's try to model this using some simple object-oriented code.
+
A Window object is made up of tabs, and you usually have more than one Window open. The titles of each open site in each Window object is held in an array. After working in the browser (opening new tabs, merging windows, and closing tabs), you want to print the tabs that are still open. Closed tabs are removed from the array and new tabs (for simplicity) get added to the end of it.
-The code editor shows an implementation of this functionality with functions for tabOpen(), tabClose(), and join(). The array tabs is part of the Window object that stores the name of the open pages.
+The code editor shows an implementation of this functionality with functions for `tabOpen()`, `tabClose()`, and `join()`. The array `tabs` is part of the Window object that stores the name of the open pages.
-
+# --instructions--
+Examine the code in the editor. It's using a method that has side effects in the program, causing incorrect behaviour. The final list of open tabs, stored in `finalTabs.tabs`, should be `['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium', 'new tab', 'Netflix', 'YouTube', 'Vine', 'GMail', 'Work mail', 'Docs', 'freeCodeCamp', 'new tab']` but the list produced by the code is slightly different.
-## Instructions
-
-Examine the code in the editor. It's using a method that has side effects in the program, causing incorrect behaviour. The final list of open tabs, stored in finalTabs.tabs, should be ['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium', 'new tab', 'Netflix', 'YouTube', 'Vine', 'GMail', 'Work mail', 'Docs', 'freeCodeCamp', 'new tab'] but the list produced by the code is slightly different.
+Change `Window.prototype.tabClose` so that it removes the correct tab.
-Change Window.prototype.tabClose so that it removes the correct tab.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: finalTabs.tabs should be ['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium', 'new tab', 'Netflix', 'YouTube', 'Vine', 'GMail', 'Work mail', 'Docs', 'freeCodeCamp', 'new tab']
- testString: assert.deepEqual(finalTabs.tabs, ['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium', 'new tab', 'Netflix', 'YouTube', 'Vine', 'GMail', 'Work mail', 'Docs', 'freeCodeCamp', 'new tab'])
+`finalTabs.tabs` should be `['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium', 'new tab', 'Netflix', 'YouTube', 'Vine', 'GMail', 'Work mail', 'Docs', 'freeCodeCamp', 'new tab']`
+```js
+assert.deepEqual(finalTabs.tabs, [
+ 'FB',
+ 'Gitter',
+ 'Reddit',
+ 'Twitter',
+ 'Medium',
+ 'new tab',
+ 'Netflix',
+ 'YouTube',
+ 'Vine',
+ 'GMail',
+ 'Work mail',
+ 'Docs',
+ 'freeCodeCamp',
+ 'new tab'
+]);
```
-
+# --seed--
-## Challenge Seed
-
-
-
+## --seed-contents--
```js
// tabs is an array of titles of each site open within the window
@@ -90,14 +102,7 @@ var finalTabs = socialWindow
console.log(finalTabs.tabs);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
// tabs is an array of titles of each site open within the window
@@ -137,5 +142,3 @@ var finalTabs = socialWindow
.join(videoWindow.tabClose(2)) // Close third tab in video window, and join
.join(workWindow.tabClose(1).tabOpen());
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md
index 4af8b13ecb..ed23075327 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md
@@ -1,50 +1,74 @@
---
id: 587d7b88367417b2b2512b45
-title: Use Higher-Order Functions map, filter, or reduce to Solve a Complex Problem
+title: 'Use Higher-Order Functions map, filter, or reduce to Solve a Complex Problem'
challengeType: 1
forumTopicId: 301311
---
-## Description
+# --description--
-
-Now that you have worked through a few challenges using higher-order functions like map(), filter(), and reduce(), you now get to apply them to solve a more complex challenge.
-
+Now that you have worked through a few challenges using higher-order functions like `map()`, `filter()`, and `reduce()`, you now get to apply them to solve a more complex challenge.
-## Instructions
+# --instructions--
-
-We have defined a function named squareList. You need to complete the code for the squareList function using any combination of map(), filter(), and reduce() so that it returns a new array containing only the square of only the positive integers (decimal numbers are not integers) when an array of real numbers is passed to it. An example of an array containing only real numbers is [-3, 4.8, 5, 3, -3.2].
-Note: Your function should not use any kind of for or while loops or the forEach() function.
-
+We have defined a function named `squareList`. You need to complete the code for the `squareList` function using any combination of `map()`, `filter()`, and `reduce()` so that it returns a new array containing only the square of *only* the positive integers (decimal numbers are not integers) when an array of real numbers is passed to it. An example of an array containing only real numbers is `[-3, 4.8, 5, 3, -3.2]`.
-## Tests
+**Note:** Your function should not use any kind of `for` or `while` loops or the `forEach()` function.
-
+# --hints--
-```yml
-tests:
- - text: squareList should be a function.
- testString: assert.typeOf(squareList, 'function'), 'squareList should be a function';
- - text: for, while, and forEach should not be used.
- testString: assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g));
- - text: map, filter, or reduce should be used.
- testString: assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/\.(map|filter|reduce)\(/g));
- - text: The function should return an array.
- testString: assert(Array.isArray(squareList([4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2])));
- - text: squareList([4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2]) should return [16, 1764, 36].
- testString: assert.deepStrictEqual(squareList([4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2]), [16, 1764, 36]);
- - text: squareList([-3.7, -5, 3, 10, 12.5, 7, -4.5, -17, 0.3]) should return [9, 100, 49].
- testString: assert.deepStrictEqual(squareList([-3.7, -5, 3, 10, 12.5, 7, -4.5, -17, 0.3]), [9, 100, 49]);
+`squareList` should be a `function`.
+
+```js
+assert.typeOf(squareList, 'function'),
+ 'squareList should be a function';
```
-
+`for`, `while`, and `forEach` should not be used.
-## Challenge Seed
+```js
+assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g));
+```
-
+`map`, `filter`, or `reduce` should be used.
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
const squareList = arr => {
@@ -76,5 +94,3 @@ const squareList = arr => {
return squaredIntegers;
};
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md
index 4317257488..fba0dbfc0a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md
@@ -5,10 +5,11 @@ challengeType: 1
forumTopicId: 301312
---
-## Description
-
-The every method works with arrays to check if every element passes a particular test. It returns a Boolean value - true if all values meet the criteria, false if not.
-For example, the following code would check if every element in the numbers array is less than 10:
+# --description--
+
+The `every` method works with arrays to check if *every* element passes a particular test. It returns a Boolean value - `true` if all values meet the criteria, `false` if not.
+
+For example, the following code would check if every element in the `numbers` array is less than 10:
```js
var numbers = [1, 5, 8, 0, 10, 11];
@@ -18,35 +19,39 @@ numbers.every(function(currentValue) {
// Returns false
```
-
+# --instructions--
-## Instructions
-
-Use the every method inside the checkPositive function to check if every element in arr is positive. The function should return a Boolean value.
-
+Use the `every` method inside the `checkPositive` function to check if every element in `arr` is positive. The function should return a Boolean value.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should use the every method.
- testString: assert(code.match(/\.every/g));
- - text: checkPositive([1, 2, 3, -4, 5]) should return false.
- testString: assert.isFalse(checkPositive([1, 2, 3, -4, 5]));
- - text: checkPositive([1, 2, 3, 4, 5]) should return true.
- testString: assert.isTrue(checkPositive([1, 2, 3, 4, 5]));
- - text: checkPositive([1, -2, 3, -4, 5]) should return false.
- testString: assert.isFalse(checkPositive([1, -2, 3, -4, 5]));
+Your code should use the `every` method.
+```js
+assert(code.match(/\.every/g));
```
-
+`checkPositive([1, 2, 3, -4, 5])` should return `false`.
-## Challenge Seed
-
+```js
+assert.isFalse(checkPositive([1, 2, 3, -4, 5]));
+```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
function checkPositive(arr) {
@@ -75,5 +73,3 @@ function checkPositive(arr) {
}
checkPositive([1, 2, 3, -4, 5]);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md
index ae5b3a6afd..c669c3fae4 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md
@@ -5,12 +5,15 @@ challengeType: 1
forumTopicId: 18179
---
-## Description
-
-Another useful array function is Array.prototype.filter(), or simply filter().
-filter calls a function on each element of an array and returns a new array containing only the elements for which that function returns true. In other words, it filters the array, based on the function passed to it. Like map, it does this without needing to modify the original array.
-The callback function accepts three arguments. The first argument is the current element being processed. The second is the index of that element and the third is the array upon which the filter method was called.
-See below for an example using the filter method on the users array to return a new array containing only the users under the age of 30. For simplicity, the example only uses the first argument of the callback.
+# --description--
+
+Another useful array function is `Array.prototype.filter()`, or simply `filter()`.
+
+`filter` calls a function on each element of an array and returns a new array containing only the elements for which that function returns `true`. In other words, it filters the array, based on the function passed to it. Like `map`, it does this without needing to modify the original array.
+
+The callback function accepts three arguments. The first argument is the current element being processed. The second is the index of that element and the third is the array upon which the `filter` method was called.
+
+See below for an example using the `filter` method on the `users` array to return a new array containing only the users under the age of 30. For simplicity, the example only uses the first argument of the callback.
```js
const users = [
@@ -23,35 +26,46 @@ const usersUnder30 = users.filter(user => user.age < 30);
console.log(usersUnder30); // [ { name: 'Amy', age: 20 }, { name: 'camperCat', age: 10 } ]
```
-
+# --instructions--
-## Instructions
-
-The variable watchList holds an array of objects with information on several movies. Use a combination of filter and map on watchList to assign a new array of objects with only title and rating keys. The new array should only include objects where imdbRating is greater than or equal to 8.0. Note that the rating values are saved as strings in the object and you may need to convert them into numbers to perform mathematical operations on them.
-
+The variable `watchList` holds an array of objects with information on several movies. Use a combination of `filter` and `map` on `watchList` to assign a new array of objects with only `title` and `rating` keys. The new array should only include objects where `imdbRating` is greater than or equal to 8.0. Note that the rating values are saved as strings in the object and you may need to convert them into numbers to perform mathematical operations on them.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: The watchList variable should not change.
- testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
- - text: Your code should use the filter method.
- testString: assert(code.match(/\.filter/g));
- - text: Your code should not use a for loop.
- testString: assert(!code.match(/for\s*?\([\s\S]*?\)/g));
- - text: 'filteredList should equal [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}].'
- testString: 'assert.deepEqual(filteredList, [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]);'
+The `watchList` variable should not change.
+```js
+assert(
+ watchList[0].Title === 'Inception' && watchList[4].Director == 'James Cameron'
+);
```
-
+Your code should use the `filter` method.
-## Challenge Seed
-
+```js
+assert(code.match(/\.filter/g));
+```
-
+Your code should not use a `for` loop.
+
+```js
+assert(!code.match(/for\s*?\([\s\S]*?\)/g));
+```
+
+`filteredList` should equal `[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]`.
+
+```js
+assert.deepEqual(filteredList, [
+ { title: 'Inception', rating: '8.8' },
+ { title: 'Interstellar', rating: '8.6' },
+ { title: 'The Dark Knight', rating: '9.0' },
+ { title: 'Batman Begins', rating: '8.3' }
+]);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// The global variable
@@ -177,14 +191,7 @@ var filteredList;
console.log(filteredList);
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
// The global variable
@@ -305,5 +312,3 @@ var watchList = [
let filteredList = watchList.filter(e => e.imdbRating >= 8).map( ({Title: title, imdbRating: rating}) => ({title, rating}) );
// Only change code above this line
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md
index 2d51d7fe0c..c69c491b86 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md
@@ -5,15 +5,21 @@ challengeType: 1
forumTopicId: 18214
---
-## Description
-
+# --description--
+
So far we have learned to use pure functions to avoid side effects in a program. Also, we have seen the value in having a function only depend on its input arguments.
+
This is only the beginning. As its name suggests, functional programming is centered around a theory of functions.
+
It would make sense to be able to pass them as arguments to other functions, and return a function from another function. Functions are considered first class objects in JavaScript, which means they can be used like any other object. They can be saved in variables, stored in an object, or passed as function arguments.
-Let's start with some simple array functions, which are methods on the array object prototype. In this exercise we are looking at Array.prototype.map(), or more simply map.
-The map method iterates over each item in an array and returns a new array containing the results of calling the callback function on each element. It does this without mutating the original array.
-When the callback is used, it is passed three arguments. The first argument is the current element being processed. The second is the index of that element and the third is the array upon which the map method was called.
-See below for an example using the map method on the users array to return a new array containing only the names of the users as elements. For simplicity, the example only uses the first argument of the callback.
+
+Let's start with some simple array functions, which are methods on the array object prototype. In this exercise we are looking at `Array.prototype.map()`, or more simply `map`.
+
+The `map` method iterates over each item in an array and returns a new array containing the results of calling the callback function on each element. It does this without mutating the original array.
+
+When the callback is used, it is passed three arguments. The first argument is the current element being processed. The second is the index of that element and the third is the array upon which the `map` method was called.
+
+See below for an example using the `map` method on the `users` array to return a new array containing only the names of the users as elements. For simplicity, the example only uses the first argument of the callback.
```js
const users = [
@@ -26,35 +32,47 @@ const names = users.map(user => user.name);
console.log(names); // [ 'John', 'Amy', 'camperCat' ]
```
-
+# --instructions--
-## Instructions
-
-The watchList array holds objects with information on several movies. Use map on watchList to assign a new array of objects with only title and rating keys to the ratings variable. The code in the editor currently uses a for loop to do this, so you should replace the loop functionality with your map expression.
-
+The `watchList` array holds objects with information on several movies. Use `map` on `watchList` to assign a new array of objects with only `title` and `rating` keys to the `ratings` variable. The code in the editor currently uses a `for` loop to do this, so you should replace the loop functionality with your `map` expression.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: The watchList variable should not change.
- testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
- - text: Your code should not use a for loop.
- testString: assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/));
- - text: Your code should use the map method.
- testString: assert(code.match(/\.map/g));
- - text: ratings should equal [{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}].
- testString: assert.deepEqual(ratings, [{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]);
+The `watchList` variable should not change.
+```js
+assert(
+ watchList[0].Title === 'Inception' && watchList[4].Director == 'James Cameron'
+);
```
-
+Your code should not use a `for` loop.
-## Challenge Seed
-
+```js
+assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/));
+```
-
+Your code should use the `map` method.
+
+```js
+assert(code.match(/\.map/g));
+```
+
+`ratings` should equal `[{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]`.
+
+```js
+assert.deepEqual(ratings, [
+ { title: 'Inception', rating: '8.8' },
+ { title: 'Interstellar', rating: '8.6' },
+ { title: 'The Dark Knight', rating: '9.0' },
+ { title: 'Batman Begins', rating: '8.3' },
+ { title: 'Avatar', rating: '7.9' }
+]);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// The global variable
@@ -183,12 +201,7 @@ for(var i=0; i < watchList.length; i++){
console.log(JSON.stringify(ratings));
```
-
-
-
-
-## Solution
-
+# --solutions--
```js
// The global variable
@@ -312,5 +325,3 @@ var ratings = watchList.map(function(movie) {
}
});
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md
index 0cf9f756c9..f77a179f64 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md
@@ -5,19 +5,17 @@ challengeType: 1
forumTopicId: 301313
---
-## Description
-
+# --description--
-Array.prototype.reduce(), or simply reduce(), is the most general of all array operations in JavaScript. You can solve almost any array processing problem using the reduce method.
+`Array.prototype.reduce()`, or simply `reduce()`, is the most general of all array operations in JavaScript. You can solve almost any array processing problem using the `reduce` method.
-The reduce method allows for more general forms of array processing, and it's possible to show that both filter and map can be derived as special applications of reduce.
-The reduce method iterates over each item in an array and returns a single value (i.e. string, number, object, array). This is achieved via a callback function that is called on each iteration.
+The `reduce` method allows for more general forms of array processing, and it's possible to show that both `filter` and `map` can be derived as special applications of `reduce`. The `reduce` method iterates over each item in an array and returns a single value (i.e. string, number, object, array). This is achieved via a callback function that is called on each iteration.
-The callback function accepts four arguments. The first argument is known as the accumulator, which gets assigned the return value of the callback function from the previous iteration, the second is the current element being processed, the third is the index of that element and the fourth is the array upon which reduce is called.
+The callback function accepts four arguments. The first argument is known as the accumulator, which gets assigned the return value of the callback function from the previous iteration, the second is the current element being processed, the third is the index of that element and the fourth is the array upon which `reduce` is called.
-In addition to the callback function, reduce has an additional parameter which takes an initial value for the accumulator. If this second parameter is not used, then the first iteration is skipped and the second iteration gets passed the first element of the array as the accumulator.
+In addition to the callback function, `reduce` has an additional parameter which takes an initial value for the accumulator. If this second parameter is not used, then the first iteration is skipped and the second iteration gets passed the first element of the array as the accumulator.
-See below for an example using reduce on the users array to return the sum of all the users' ages. For simplicity, the example only uses the first and second arguments.
+See below for an example using `reduce` on the `users` array to return the sum of all the users' ages. For simplicity, the example only uses the first and second arguments.
```js
const users = [
@@ -46,37 +44,47 @@ const usersObj = users.reduce((obj, user) => {
console.log(usersObj); // { John: 34, Amy: 20, camperCat: 10 }
```
-
+# --instructions--
-## Instructions
-
-The variable watchList holds an array of objects with information on several movies. Use reduce to find the average IMDB rating of the movies directed by Christopher Nolan. Recall from prior challenges how to filter data and map over it to pull what you need. You may need to create other variables, and return the average rating from getRating function. Note that the rating values are saved as strings in the object and need to be converted into numbers before they are used in any mathematical operations.
-
+The variable `watchList` holds an array of objects with information on several movies. Use `reduce` to find the average IMDB rating of the movies **directed by Christopher Nolan**. Recall from prior challenges how to `filter` data and `map` over it to pull what you need. You may need to create other variables, and return the average rating from `getRating` function. Note that the rating values are saved as strings in the object and need to be converted into numbers before they are used in any mathematical operations.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: The watchList variable should not change.
- testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
- - text: Your code should use the reduce method.
- testString: assert(code.match(/\.reduce/g));
- - text: The getRating(watchList) should equal 8.675.
- testString: assert(getRating(watchList) === 8.675);
- - text: Your code should not use a for loop.
- testString: assert(!code.match(/for\s*?\([\s\S]*?\)/g));
- - text: Your code should return correct output after modifying the watchList object.
- testString: assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55);
+The `watchList` variable should not change.
+```js
+assert(
+ watchList[0].Title === 'Inception' && watchList[4].Director == 'James Cameron'
+);
```
-
+Your code should use the `reduce` method.
-## Challenge Seed
-
+```js
+assert(code.match(/\.reduce/g));
+```
-
+The `getRating(watchList)` should equal 8.675.
+
+```js
+assert(getRating(watchList) === 8.675);
+```
+
+Your code should not use a `for` loop.
+
+```js
+assert(!code.match(/for\s*?\([\s\S]*?\)/g));
+```
+
+Your code should return correct output after modifying the `watchList` object.
+
+```js
+assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55);
+```
+
+# --seed--
+
+## --seed-contents--
```js
// The global variable
@@ -204,14 +212,7 @@ function getRating(watchList){
console.log(getRating(watchList));
```
-
-
-
-
-
-
-## Solution
-
+# --solutions--
```js
// The global variable
@@ -336,7 +337,4 @@ function getRating(watchList){
averageRating = rating.reduce((accum, curr) => accum + curr)/rating.length;
return averageRating;
}
-
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md
index 65bbdba77d..6b0451c332 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md
@@ -5,10 +5,11 @@ challengeType: 1
forumTopicId: 301314
---
-## Description
-
-The some method works with arrays to check if any element passes a particular test. It returns a Boolean value - true if any of the values meet the criteria, false if not.
-For example, the following code would check if any element in the numbers array is less than 10:
+# --description--
+
+The `some` method works with arrays to check if *any* element passes a particular test. It returns a Boolean value - `true` if any of the values meet the criteria, `false` if not.
+
+For example, the following code would check if any element in the `numbers` array is less than 10:
```js
var numbers = [10, 50, 8, 220, 110, 11];
@@ -18,35 +19,39 @@ numbers.some(function(currentValue) {
// Returns true
```
-
+# --instructions--
-## Instructions
-
-Use the some method inside the checkPositive function to check if any element in arr is positive. The function should return a Boolean value.
-
+Use the `some` method inside the `checkPositive` function to check if any element in `arr` is positive. The function should return a Boolean value.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: Your code should use the some method.
- testString: assert(code.match(/\.some/g));
- - text: checkPositive([1, 2, 3, -4, 5]) should return true.
- testString: assert(checkPositive([1, 2, 3, -4, 5]));
- - text: checkPositive([1, 2, 3, 4, 5]) should return true.
- testString: assert(checkPositive([1, 2, 3, 4, 5]));
- - text: checkPositive([-1, -2, -3, -4, -5]) should return false.
- testString: assert(!checkPositive([-1, -2, -3, -4, -5]));
+Your code should use the `some` method.
+```js
+assert(code.match(/\.some/g));
```
-
+`checkPositive([1, 2, 3, -4, 5])` should return `true`.
-## Challenge Seed
-
+```js
+assert(checkPositive([1, 2, 3, -4, 5]));
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function diffArray(arr1, arr2) {
@@ -102,5 +188,3 @@ function diffArray(arr1, arr2) {
return newArr;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing.md
index c84f7ae791..6ca3be6964 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing.md
@@ -5,40 +5,59 @@ challengeType: 5
forumTopicId: 16009
---
-## Description
-
+# --description--
+
The DNA strand is missing the pairing element. Take each character, get its pair, and return the results as a 2d array.
-Base pairs are a pair of AT and CG. Match the missing element to the provided character.
+
+[Base pairs](http://en.wikipedia.org/wiki/Base_pair) are a pair of AT and CG. Match the missing element to the provided character.
+
Return the provided character as the first element in each array.
-For example, for the input GCG, return [["G", "C"], ["C","G"],["G", "C"]]
+
+For example, for the input GCG, return \[\["G", "C"], \["C","G"],\["G", "C"]]
+
The character and its pair are paired up in an array, and all the arrays are grouped into one encapsulating array.
-
-## Instructions
-
+# --hints--
-
-
-## Tests
-
-
-```yml
-tests:
- - text: pairElement("ATCGA") should return [["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]].
- testString: assert.deepEqual(pairElement("ATCGA"),[["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]);
- - text: pairElement("TTGAG") should return [["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]].
- testString: assert.deepEqual(pairElement("TTGAG"),[["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]);
- - text: pairElement("CTCTA") should return [["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]].
- testString: assert.deepEqual(pairElement("CTCTA"),[["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]);
+`pairElement("ATCGA")` should return `[["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]`.
+```js
+assert.deepEqual(pairElement('ATCGA'), [
+ ['A', 'T'],
+ ['T', 'A'],
+ ['C', 'G'],
+ ['G', 'C'],
+ ['A', 'T']
+]);
```
-
+`pairElement("TTGAG")` should return `[["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]`.
-## Challenge Seed
-
+```js
+assert.deepEqual(pairElement('TTGAG'), [
+ ['T', 'A'],
+ ['T', 'A'],
+ ['G', 'C'],
+ ['A', 'T'],
+ ['G', 'C']
+]);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var lookup = Object.create(null);
@@ -69,5 +80,3 @@ function pairElement(str) {
return str.split('').map(function(p) {return [p, lookup[p]];});
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it.md
index c8e5563246..e5caeb7567 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it.md
@@ -5,43 +5,83 @@ challengeType: 5
forumTopicId: 16010
---
-## Description
-
-Given the array arr, iterate through and remove each element starting from the first element (the 0 index) until the function func returns true when the iterated element is passed through it.
-Then return the rest of the array once the condition is satisfied, otherwise, arr should be returned as an empty array.
-
+# --description--
-## Instructions
-
+Given the array `arr`, iterate through and remove each element starting from the first element (the 0 index) until the function `func` returns `true` when the iterated element is passed through it.
-
+Then return the rest of the array once the condition is satisfied, otherwise, `arr` should be returned as an empty array.
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: dropElements([1, 2, 3, 4], function(n) {return n >= 3;}) should return [3, 4].
- testString: assert.deepEqual(dropElements([1, 2, 3, 4], function(n) {return n >= 3;}), [3, 4]);
- - text: dropElements([0, 1, 0, 1], function(n) {return n === 1;}) should return [1, 0, 1].
- testString: assert.deepEqual(dropElements([0, 1, 0, 1], function(n) {return n === 1;}), [1, 0, 1]);
- - text: dropElements([1, 2, 3], function(n) {return n > 0;}) should return [1, 2, 3].
- testString: assert.deepEqual(dropElements([1, 2, 3], function(n) {return n > 0;}), [1, 2, 3]);
- - text: dropElements([1, 2, 3, 4], function(n) {return n > 5;}) should return [].
- testString: assert.deepEqual(dropElements([1, 2, 3, 4], function(n) {return n > 5;}), []);
- - text: dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;}) should return [7, 4].
- testString: assert.deepEqual(dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;}), [7, 4]);
- - text: dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;}) should return [3, 9, 2].
- testString: assert.deepEqual(dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;}), [3, 9, 2]);
+`dropElements([1, 2, 3, 4], function(n) {return n >= 3;})` should return `[3, 4]`.
+```js
+assert.deepEqual(
+ dropElements([1, 2, 3, 4], function (n) {
+ return n >= 3;
+ }),
+ [3, 4]
+);
```
-
+`dropElements([0, 1, 0, 1], function(n) {return n === 1;})` should return `[1, 0, 1]`.
-## Challenge Seed
-
+```js
+assert.deepEqual(
+ dropElements([0, 1, 0, 1], function (n) {
+ return n === 1;
+ }),
+ [1, 0, 1]
+);
+```
-
+`dropElements([1, 2, 3], function(n) {return n > 0;})` should return `[1, 2, 3]`.
+
+```js
+assert.deepEqual(
+ dropElements([1, 2, 3], function (n) {
+ return n > 0;
+ }),
+ [1, 2, 3]
+);
+```
+
+`dropElements([1, 2, 3, 4], function(n) {return n > 5;})` should return `[]`.
+
+```js
+assert.deepEqual(
+ dropElements([1, 2, 3, 4], function (n) {
+ return n > 5;
+ }),
+ []
+);
+```
+
+`dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;})` should return `[7, 4]`.
+
+```js
+assert.deepEqual(
+ dropElements([1, 2, 3, 7, 4], function (n) {
+ return n > 3;
+ }),
+ [7, 4]
+);
+```
+
+`dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;})` should return `[3, 9, 2]`.
+
+```js
+assert.deepEqual(
+ dropElements([1, 2, 3, 9, 2], function (n) {
+ return n > 2;
+ }),
+ [3, 9, 2]
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function dropElements(arr, func) {
@@ -51,15 +91,7 @@ function dropElements(arr, func) {
dropElements([1, 2, 3], function(n) {return n < 3; });
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function dropElements(arr, func) {
@@ -69,5 +101,3 @@ function dropElements(arr, func) {
return arr;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/everything-be-true.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/everything-be-true.md
index 3ab0fb6165..5bbe0d4826 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/everything-be-true.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/everything-be-true.md
@@ -5,51 +5,137 @@ challengeType: 5
forumTopicId: 16011
---
-## Description
-
+# --description--
+
Check if the predicate (second argument) is truthy on all elements of a collection (first argument).
-In other words, you are given an array collection of objects. The predicate pre will be an object property and you need to return true if its value is truthy. Otherwise, return false.
-In JavaScript, truthy values are values that translate to true when evaluated in a Boolean context.
-Remember, you can access object properties through either dot notation or [] notation.
-
-## Instructions
-
+In other words, you are given an array collection of objects. The predicate `pre` will be an object property and you need to return `true` if its value is `truthy`. Otherwise, return `false`.
-
+In JavaScript, `truthy` values are values that translate to `true` when evaluated in a Boolean context.
-## Tests
-
+Remember, you can access object properties through either dot notation or `[]` notation.
-```yml
-tests:
- - text: 'truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex") should return true.'
- testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"), true);'
- - text: 'truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex") should return false.'
- testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"), false);'
- - text: 'truthCheck([{"user": "Tinky-Winky", "sex": "male", "age": 0}, {"user": "Dipsy", "sex": "male", "age": 3}, {"user": "Laa-Laa", "sex": "female", "age": 5}, {"user": "Po", "sex": "female", "age": 4}], "age") should return false.'
- testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male", "age": 2}, {"user": "Dipsy", "sex": "male", "age": 0}, {"user": "Laa-Laa", "sex": "female", "age": 5}, {"user": "Po", "sex": "female", "age": 4}], "age"), false);'
- - text: 'truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastForward", "onBoat": null}], "onBoat") should return false'
- testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastForward", "onBoat": null}], "onBoat"), false);'
- - text: 'truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastForward", "onBoat": true}], "onBoat") should return true'
- testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastForward", "onBoat": true}], "onBoat"), true);'
- - text: 'truthCheck([{"single": "yes"}], "single") should return true'
- testString: 'assert.strictEqual(truthCheck([{"single": "yes"}], "single"), true);'
- - text: 'truthCheck([{"single": ""}, {"single": "double"}], "single") should return false'
- testString: 'assert.strictEqual(truthCheck([{"single": ""}, {"single": "double"}], "single"), false);'
- - text: 'truthCheck([{"single": "double"}, {"single": undefined}], "single") should return false'
- testString: 'assert.strictEqual(truthCheck([{"single": "double"}, {"single": undefined}], "single"), false);'
- - text: 'truthCheck([{"single": "double"}, {"single": NaN}], "single") should return false'
- testString: 'assert.strictEqual(truthCheck([{"single": "double"}, {"single": NaN}], "single"), false);'
+# --hints--
+`truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex")` should return true.
+
+```js
+assert.strictEqual(
+ truthCheck(
+ [
+ { user: 'Tinky-Winky', sex: 'male' },
+ { user: 'Dipsy', sex: 'male' },
+ { user: 'Laa-Laa', sex: 'female' },
+ { user: 'Po', sex: 'female' }
+ ],
+ 'sex'
+ ),
+ true
+);
```
-
+`truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex")` should return false.
-## Challenge Seed
-
+```js
+assert.strictEqual(
+ truthCheck(
+ [
+ { user: 'Tinky-Winky', sex: 'male' },
+ { user: 'Dipsy' },
+ { user: 'Laa-Laa', sex: 'female' },
+ { user: 'Po', sex: 'female' }
+ ],
+ 'sex'
+ ),
+ false
+);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function truthCheck(collection, pre) {
return collection.every(function(e) { return e[pre]; });
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md
index cc182083e8..cbbe8b38fc 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.md
@@ -5,8 +5,8 @@ challengeType: 5
forumTopicId: 16020
---
-## Description
-
+# --description--
+
Fill in the object constructor with the following methods below:
```js
@@ -18,54 +18,124 @@ setLastName(last)
setFullName(firstAndLast)
```
-Run the tests to see the expected output for each method.
-The methods that take an argument must accept only one argument and it has to be a string.
-These methods must be the only available means of interacting with the object.
-
+Run the tests to see the expected output for each method. The methods that take an argument must accept only one argument and it has to be a string. These methods must be the only available means of interacting with the object.
-## Instructions
-
+# --hints--
-
-
-## Tests
-
-
-```yml
-tests:
- - text: Object.keys(bob).length should return 6.
- testString: assert.deepEqual(Object.keys(bob).length, 6);
- - text: bob instanceof Person should return true.
- testString: assert.deepEqual(bob instanceof Person, true);
- - text: bob.firstName should return undefined.
- testString: assert.deepEqual(bob.firstName, undefined);
- - text: bob.lastName should return undefined.
- testString: assert.deepEqual(bob.lastName, undefined);
- - text: bob.getFirstName() should return "Bob".
- testString: assert.deepEqual(bob.getFirstName(), 'Bob');
- - text: bob.getLastName() should return "Ross".
- testString: assert.deepEqual(bob.getLastName(), 'Ross');
- - text: bob.getFullName() should return "Bob Ross".
- testString: assert.deepEqual(bob.getFullName(), 'Bob Ross');
- - text: bob.getFullName() should return "Haskell Ross" after bob.setFirstName("Haskell").
- testString: assert.strictEqual((function () { bob.setFirstName("Haskell"); return bob.getFullName(); })(), 'Haskell Ross');
- - text: bob.getFullName() should return "Haskell Curry" after bob.setLastName("Curry").
- testString: assert.strictEqual((function () { var _bob=new Person('Haskell Ross'); _bob.setLastName("Curry"); return _bob.getFullName(); })(), 'Haskell Curry');
- - text: bob.getFullName() should return "Haskell Curry" after bob.setFullName("Haskell Curry").
- testString: assert.strictEqual((function () { bob.setFullName("Haskell Curry"); return bob.getFullName(); })(), 'Haskell Curry');
- - text: bob.getFirstName() should return "Haskell" after bob.setFullName("Haskell Curry").
- testString: assert.strictEqual((function () { bob.setFullName("Haskell Curry"); return bob.getFirstName(); })(), 'Haskell');
- - text: bob.getLastName() should return "Curry" after bob.setFullName("Haskell Curry").
- testString: assert.strictEqual((function () { bob.setFullName("Haskell Curry"); return bob.getLastName(); })(), 'Curry');
+`Object.keys(bob).length` should return 6.
+```js
+assert.deepEqual(Object.keys(bob).length, 6);
```
-
+`bob instanceof Person` should return true.
-## Challenge Seed
-
+```js
+assert.deepEqual(bob instanceof Person, true);
+```
-
+`bob.firstName` should return undefined.
+
+```js
+assert.deepEqual(bob.firstName, undefined);
+```
+
+`bob.lastName` should return undefined.
+
+```js
+assert.deepEqual(bob.lastName, undefined);
+```
+
+`bob.getFirstName()` should return "Bob".
+
+```js
+assert.deepEqual(bob.getFirstName(), 'Bob');
+```
+
+`bob.getLastName()` should return "Ross".
+
+```js
+assert.deepEqual(bob.getLastName(), 'Ross');
+```
+
+`bob.getFullName()` should return "Bob Ross".
+
+```js
+assert.deepEqual(bob.getFullName(), 'Bob Ross');
+```
+
+`bob.getFullName()` should return "Haskell Ross" after `bob.setFirstName("Haskell")`.
+
+```js
+assert.strictEqual(
+ (function () {
+ bob.setFirstName('Haskell');
+ return bob.getFullName();
+ })(),
+ 'Haskell Ross'
+);
+```
+
+`bob.getFullName()` should return "Haskell Curry" after `bob.setLastName("Curry")`.
+
+```js
+assert.strictEqual(
+ (function () {
+ var _bob = new Person('Haskell Ross');
+ _bob.setLastName('Curry');
+ return _bob.getFullName();
+ })(),
+ 'Haskell Curry'
+);
+```
+
+`bob.getFullName()` should return "Haskell Curry" after `bob.setFullName("Haskell Curry")`.
+
+```js
+assert.strictEqual(
+ (function () {
+ bob.setFullName('Haskell Curry');
+ return bob.getFullName();
+ })(),
+ 'Haskell Curry'
+);
+```
+
+`bob.getFirstName()` should return "Haskell" after `bob.setFullName("Haskell Curry")`.
+
+```js
+assert.strictEqual(
+ (function () {
+ bob.setFullName('Haskell Curry');
+ return bob.getFirstName();
+ })(),
+ 'Haskell'
+);
+```
+
+`bob.getLastName()` should return "Curry" after `bob.setFullName("Haskell Curry")`.
+
+```js
+assert.strictEqual(
+ (function () {
+ bob.setFullName('Haskell Curry');
+ return bob.getLastName();
+ })(),
+ 'Curry'
+);
+```
+
+# --seed--
+
+## --after-user-code--
+
+```js
+if(bob){
+ bob = new Person("Bob Ross");
+}
+```
+
+## --seed-contents--
```js
var Person = function(firstAndLast) {
@@ -81,26 +151,7 @@ var bob = new Person('Bob Ross');
bob.getFullName();
```
-
-
-### After Test
-
-
-
-```js
-if(bob){
- bob = new Person("Bob Ross");
-}
-```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
var Person = function(firstAndLast) {
@@ -143,5 +194,3 @@ var Person = function(firstAndLast) {
var bob = new Person('Bob Ross');
bob.getFullName();
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md
index 17c4aa3241..4fdbaaa049 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.md
@@ -5,38 +5,48 @@ challengeType: 5
forumTopicId: 16021
---
-## Description
-
+# --description--
+
Return a new array that transforms the elements' average altitude into their orbital periods (in seconds).
-The array will contain objects in the format {name: 'name', avgAlt: avgAlt}.
-You can read about orbital periods on Wikipedia.
+
+The array will contain objects in the format `{name: 'name', avgAlt: avgAlt}`.
+
+You can read about orbital periods [on Wikipedia](http://en.wikipedia.org/wiki/Orbital_period).
+
The values should be rounded to the nearest whole number. The body being orbited is Earth.
+
The radius of the earth is 6367.4447 kilometers, and the GM value of earth is 398600.4418 km3s-2.
-
-## Instructions
-
+# --hints--
-
-
-## Tests
-
-
-```yml
-tests:
- - text: 'orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]) should return [{name: "sputnik", orbitalPeriod: 86400}].'
- testString: 'assert.deepEqual(orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]), [{name: "sputnik", orbitalPeriod: 86400}]);'
- - text: 'orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}]) should return [{name : "iss", orbitalPeriod: 5557}, {name: "hubble", orbitalPeriod: 5734}, {name: "moon", orbitalPeriod: 2377399}].'
- testString: 'assert.deepEqual(orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}]), [{name : "iss", orbitalPeriod: 5557}, {name: "hubble", orbitalPeriod: 5734}, {name: "moon", orbitalPeriod: 2377399}]);'
+`orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}])` should return `[{name: "sputnik", orbitalPeriod: 86400}]`.
+```js
+assert.deepEqual(orbitalPeriod([{ name: 'sputnik', avgAlt: 35873.5553 }]), [
+ { name: 'sputnik', orbitalPeriod: 86400 }
+]);
```
-
+`orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}])` should return `[{name : "iss", orbitalPeriod: 5557}, {name: "hubble", orbitalPeriod: 5734}, {name: "moon", orbitalPeriod: 2377399}]`.
-## Challenge Seed
-
+```js
+assert.deepEqual(
+ orbitalPeriod([
+ { name: 'iss', avgAlt: 413.6 },
+ { name: 'hubble', avgAlt: 556.7 },
+ { name: 'moon', avgAlt: 378632.553 }
+ ]),
+ [
+ { name: 'iss', orbitalPeriod: 5557 },
+ { name: 'hubble', orbitalPeriod: 5734 },
+ { name: 'moon', orbitalPeriod: 2377399 }
+ ]
+);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function orbitalPeriod(arr) {
@@ -72,7 +74,4 @@ function orbitalPeriod(arr) {
}
orbitalPeriod([{name : "sputkin", avgAlt : 35873.5553}]);
-
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters.md
index 6411eedd24..20325f25fa 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters.md
@@ -5,41 +5,47 @@ challengeType: 5
forumTopicId: 16023
---
-## Description
-
+# --description--
+
Find the missing letter in the passed letter range and return it.
+
If all letters are present in the range, return undefined.
-
-## Instructions
-
+# --hints--
-
-
-## Tests
-
-
-```yml
-tests:
- - text: fearNotLetter("abce") should return "d".
- testString: assert.deepEqual(fearNotLetter('abce'), 'd');
- - text: fearNotLetter("abcdefghjklmno") should return "i".
- testString: assert.deepEqual(fearNotLetter('abcdefghjklmno'), 'i');
- - text: fearNotLetter("stvwx") should return "u".
- testString: assert.deepEqual(fearNotLetter('stvwx'), 'u');
- - text: fearNotLetter("bcdf") should return "e".
- testString: assert.deepEqual(fearNotLetter('bcdf'), 'e');
- - text: fearNotLetter("abcdefghijklmnopqrstuvwxyz") should return undefined.
- testString: assert.isUndefined(fearNotLetter('abcdefghijklmnopqrstuvwxyz'));
+`fearNotLetter("abce")` should return "d".
+```js
+assert.deepEqual(fearNotLetter('abce'), 'd');
```
-
+`fearNotLetter("abcdefghjklmno")` should return "i".
-## Challenge Seed
-
+```js
+assert.deepEqual(fearNotLetter('abcdefghjklmno'), 'i');
+```
-
+`fearNotLetter("stvwx")` should return "u".
+
+```js
+assert.deepEqual(fearNotLetter('stvwx'), 'u');
+```
+
+`fearNotLetter("bcdf")` should return "e".
+
+```js
+assert.deepEqual(fearNotLetter('bcdf'), 'e');
+```
+
+`fearNotLetter("abcdefghijklmnopqrstuvwxyz")` should return undefined.
+
+```js
+assert.isUndefined(fearNotLetter('abcdefghijklmnopqrstuvwxyz'));
+```
+
+# --seed--
+
+## --seed-contents--
```js
function fearNotLetter(str) {
@@ -49,15 +55,7 @@ function fearNotLetter(str) {
fearNotLetter("abce");
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function fearNotLetter (str) {
@@ -71,5 +69,3 @@ function fearNotLetter (str) {
return undefined;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin.md
index 54dfa58718..120a2ad596 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin.md
@@ -5,46 +5,65 @@ challengeType: 5
forumTopicId: 16039
---
-## Description
-
+# --description--
+
Pig Latin is a way of altering English Words. The rules are as follows:
-- If a word begins with a consonant, take the first consonant or consonant cluster, move it to the end of the word, and add "ay" to it.
-- If a word begins with a vowel, just add "way" at the end.
-
-## Instructions
-
+\- If a word begins with a consonant, take the first consonant or consonant cluster, move it to the end of the word, and add "ay" to it.
+
+\- If a word begins with a vowel, just add "way" at the end.
+
+# --instructions--
+
Translate the provided string to Pig Latin. Input strings are guaranteed to be English words in all lowercase.
-
-## Tests
-
+# --hints--
-```yml
-tests:
- - text: translatePigLatin("california") should return "aliforniacay".
- testString: assert.deepEqual(translatePigLatin("california"), "aliforniacay");
- - text: translatePigLatin("paragraphs") should return "aragraphspay".
- testString: assert.deepEqual(translatePigLatin("paragraphs"), "aragraphspay");
- - text: translatePigLatin("glove") should return "oveglay".
- testString: assert.deepEqual(translatePigLatin("glove"), "oveglay");
- - text: translatePigLatin("algorithm") should return "algorithmway".
- testString: assert.deepEqual(translatePigLatin("algorithm"), "algorithmway");
- - text: translatePigLatin("eight") should return "eightway".
- testString: assert.deepEqual(translatePigLatin("eight"), "eightway");
- - text: Should handle words where the first vowel comes in the middle of the word. translatePigLatin("schwartz") should return "artzschway".
- testString: assert.deepEqual(translatePigLatin("schwartz"), "artzschway");
- - text: Should handle words without vowels. translatePigLatin("rhythm") should return "rhythmay".
- testString: assert.deepEqual(translatePigLatin("rhythm"), "rhythmay");
+`translatePigLatin("california")` should return "aliforniacay".
+```js
+assert.deepEqual(translatePigLatin('california'), 'aliforniacay');
```
-
+`translatePigLatin("paragraphs")` should return "aragraphspay".
-## Challenge Seed
-
+```js
+assert.deepEqual(translatePigLatin('paragraphs'), 'aragraphspay');
+```
-
+`translatePigLatin("glove")` should return "oveglay".
+
+```js
+assert.deepEqual(translatePigLatin('glove'), 'oveglay');
+```
+
+`translatePigLatin("algorithm")` should return "algorithmway".
+
+```js
+assert.deepEqual(translatePigLatin('algorithm'), 'algorithmway');
+```
+
+`translatePigLatin("eight")` should return "eightway".
+
+```js
+assert.deepEqual(translatePigLatin('eight'), 'eightway');
+```
+
+Should handle words where the first vowel comes in the middle of the word. `translatePigLatin("schwartz")` should return "artzschway".
+
+```js
+assert.deepEqual(translatePigLatin('schwartz'), 'artzschway');
+```
+
+Should handle words without vowels. `translatePigLatin("rhythm")` should return "rhythmay".
+
+```js
+assert.deepEqual(translatePigLatin('rhythm'), 'rhythmay');
+```
+
+# --seed--
+
+## --seed-contents--
```js
function translatePigLatin(str) {
@@ -54,15 +73,7 @@ function translatePigLatin(str) {
translatePigLatin("consonant");
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function translatePigLatin(str) {
@@ -79,5 +90,3 @@ function isVowel(c) {
return ['a', 'e', 'i', 'o', 'u'].indexOf(c.toLowerCase()) !== -1;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.md
index aaef790fcb..464c0e00e8 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.md
@@ -5,46 +5,78 @@ challengeType: 5
forumTopicId: 16045
---
-## Description
-
+# --description--
+
Perform a search and replace on the sentence using the arguments provided and return the new sentence.
+
First argument is the sentence to perform the search and replace on.
+
Second argument is the word that you will be replacing (before).
+
Third argument is what you will be replacing the second argument with (after).
-Note Preserve the case of the first character in the original word when you are replacing it. For example if you mean to replace the word "Book" with the word "dog", it should be replaced as "Dog"
-
-## Instructions
-
+**Note**
+Preserve the case of the first character in the original word when you are replacing it. For example if you mean to replace the word "Book" with the word "dog", it should be replaced as "Dog"
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: myReplace("Let us go to the store", "store", "mall") should return "Let us go to the mall".
- testString: assert.deepEqual(myReplace("Let us go to the store", "store", "mall"), "Let us go to the mall");
- - text: myReplace("He is Sleeping on the couch", "Sleeping", "sitting") should return "He is Sitting on the couch".
- testString: assert.deepEqual(myReplace("He is Sleeping on the couch", "Sleeping", "sitting"), "He is Sitting on the couch");
- - text: myReplace("I think we should look up there", "up", "Down") should return "I think we should look down there".
- testString: assert.deepEqual(myReplace("I think we should look up there", "up", "Down"), "I think we should look down there");
- - text: myReplace("This has a spellngi error", "spellngi", "spelling") should return "This has a spelling error".
- testString: assert.deepEqual(myReplace("This has a spellngi error", "spellngi", "spelling"), "This has a spelling error");
- - text: myReplace("His name is Tom", "Tom", "john") should return "His name is John".
- testString: assert.deepEqual(myReplace("His name is Tom", "Tom", "john"), "His name is John");
- - text: myReplace("Let us get back to more Coding", "Coding", "algorithms") should return "Let us get back to more Algorithms".
- testString: assert.deepEqual(myReplace("Let us get back to more Coding", "Coding", "algorithms"), "Let us get back to more Algorithms");
+`myReplace("Let us go to the store", "store", "mall")` should return "Let us go to the mall".
+```js
+assert.deepEqual(
+ myReplace('Let us go to the store', 'store', 'mall'),
+ 'Let us go to the mall'
+);
```
-
+`myReplace("He is Sleeping on the couch", "Sleeping", "sitting")` should return "He is Sitting on the couch".
-## Challenge Seed
-
+```js
+assert.deepEqual(
+ myReplace('He is Sleeping on the couch', 'Sleeping', 'sitting'),
+ 'He is Sitting on the couch'
+);
+```
-
+`myReplace("I think we should look up there", "up", "Down")` should return "I think we should look down there".
+
+```js
+assert.deepEqual(
+ myReplace('I think we should look up there', 'up', 'Down'),
+ 'I think we should look down there'
+);
+```
+
+`myReplace("This has a spellngi error", "spellngi", "spelling")` should return "This has a spelling error".
+
+```js
+assert.deepEqual(
+ myReplace('This has a spellngi error', 'spellngi', 'spelling'),
+ 'This has a spelling error'
+);
+```
+
+`myReplace("His name is Tom", "Tom", "john")` should return "His name is John".
+
+```js
+assert.deepEqual(
+ myReplace('His name is Tom', 'Tom', 'john'),
+ 'His name is John'
+);
+```
+
+`myReplace("Let us get back to more Coding", "Coding", "algorithms")` should return "Let us get back to more Algorithms".
+
+```js
+assert.deepEqual(
+ myReplace('Let us get back to more Coding', 'Coding', 'algorithms'),
+ 'Let us get back to more Algorithms'
+);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function myReplace(str, before, after) {
@@ -54,15 +86,7 @@ function myReplace(str, before, after) {
myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function myReplace(str, before, after) {
@@ -74,5 +98,3 @@ function myReplace(str, before, after) {
return str.replace(before, after);
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy.md
index aaa32f75d8..f014d59c91 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy.md
@@ -5,43 +5,81 @@ challengeType: 5
forumTopicId: 16046
---
-## Description
-
+# --description--
+
You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
-Note You have to use the arguments object.
-
-## Instructions
-
+**Note**
+You have to use the `arguments` object.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: destroyer([1, 2, 3, 1, 2, 3], 2, 3) should return [1, 1].
- testString: assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1]);
- - text: destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) should return [1, 5, 1].
- testString: assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1]);
- - text: destroyer([3, 5, 1, 2, 2], 2, 3, 5) should return [1].
- testString: assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1]);
- - text: destroyer([2, 3, 2, 3], 2, 3) should return [].
- testString: assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), []);
- - text: destroyer(["tree", "hamburger", 53], "tree", 53) should return ["hamburger"].
- testString: assert.deepEqual(destroyer(["tree", "hamburger", 53], "tree", 53), ["hamburger"]);
- - text: destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan") should return [12,92,65].
- testString: assert.deepEqual(destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan"), [12,92,65]);
+`destroyer([1, 2, 3, 1, 2, 3], 2, 3)` should return `[1, 1]`.
+```js
+assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1]);
```
-
+`destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3)` should return `[1, 5, 1]`.
-## Challenge Seed
-
+```js
+assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1]);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function destroyer(arr) {
@@ -71,7 +101,4 @@ function destroyer(arr) {
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
-
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md
index 3b90c6f141..09bf8fcaed 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.md
@@ -5,44 +5,55 @@ challengeType: 5
forumTopicId: 16075
---
-## Description
-
+# --description--
+
Find the smallest common multiple of the provided parameters that can be evenly divided by both, as well as by all sequential numbers in the range between these parameters.
+
The range will be an array of two numbers that will not necessarily be in numerical order.
-For example, if given 1 and 3, find the smallest common multiple of both 1 and 3 that is also evenly divisible by all numbers between 1 and 3. The answer here would be 6.
-
-## Instructions
-
+For example, if given 1 and 3, find the smallest common multiple of both 1 and 3 that is also evenly divisible by all numbers *between* 1 and 3. The answer here would be 6.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: smallestCommons([1, 5]) should return a number.
- testString: assert.deepEqual(typeof smallestCommons([1, 5]), 'number');
- - text: smallestCommons([1, 5]) should return 60.
- testString: assert.deepEqual(smallestCommons([1, 5]), 60);
- - text: smallestCommons([5, 1]) should return 60.
- testString: assert.deepEqual(smallestCommons([5, 1]), 60);
- - text: smallestCommons([2, 10]) should return 2520.
- testString: assert.deepEqual(smallestCommons([2, 10]), 2520);
- - text: smallestCommons([1, 13]) should return 360360.
- testString: assert.deepEqual(smallestCommons([1, 13]), 360360);
- - text: smallestCommons([23, 18]) should return 6056820.
- testString: assert.deepEqual(smallestCommons([23, 18]), 6056820);
+`smallestCommons([1, 5])` should return a number.
+```js
+assert.deepEqual(typeof smallestCommons([1, 5]), 'number');
```
-
+`smallestCommons([1, 5])` should return 60.
-## Challenge Seed
-
+```js
+assert.deepEqual(smallestCommons([1, 5]), 60);
+```
-
+```js
+assert.deepEqual(steamrollArray([1, [], [3, [[4]]]]), [1, 3, 4]);
+```
+
+`steamrollArray([1, {}, [3, [[4]]]])` should return `[1, {}, 3, 4]`.
+
+```js
+assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]);
+```
+
+Your solution should not use the `Array.prototype.flat()` or `Array.prototype.flatMap()` methods.
+
+```js
+assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/));
+```
+
+# --seed--
+
+## --seed-contents--
```js
function steamrollArray(arr) {
@@ -51,13 +53,7 @@ function steamrollArray(arr) {
steamrollArray([1, [2], [3, [[4]]]]);
```
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function steamrollArray(arr) {
@@ -73,5 +69,3 @@ function steamrollArray(arr) {
return out;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range.md
index db8634f1da..99c06f0bd5 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range.md
@@ -5,44 +5,47 @@ challengeType: 5
forumTopicId: 16083
---
-## Description
-
+# --description--
+
We'll pass you an array of two numbers. Return the sum of those two numbers plus the sum of all the numbers between them. The lowest number will not always come first.
-For example, sumAll([4,1]) should return 10 because sum of all the numbers between 1 and 4 (both inclusive) is 10.
+For example, `sumAll([4,1])` should return `10` because sum of all the numbers between 1 and 4 (both inclusive) is `10`.
+# --hints--
-
-
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: sumAll([1, 4]) should return a number.
- testString: assert(typeof sumAll([1, 4]) === 'number');
- - text: sumAll([1, 4]) should return 10.
- testString: assert.deepEqual(sumAll([1, 4]), 10);
- - text: sumAll([4, 1]) should return 10.
- testString: assert.deepEqual(sumAll([4, 1]), 10);
- - text: sumAll([5, 10]) should return 45.
- testString: assert.deepEqual(sumAll([5, 10]), 45);
- - text: sumAll([10, 5]) should return 45.
- testString: assert.deepEqual(sumAll([10, 5]), 45);
+`sumAll([1, 4])` should return a number.
+```js
+assert(typeof sumAll([1, 4]) === 'number');
```
-
+`sumAll([1, 4])` should return 10.
-## Challenge Seed
-
+```js
+assert.deepEqual(sumAll([1, 4]), 10);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function sumAll(arr) {
@@ -72,5 +67,3 @@ function sumAll(arr) {
return sum;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers.md
index c5331b3593..8430774ae4 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers.md
@@ -5,44 +5,55 @@ challengeType: 5
forumTopicId: 16084
---
-## Description
-
-Given a positive integer num, return the sum of all odd Fibonacci numbers that are less than or equal to num.
+# --description--
+
+Given a positive integer `num`, return the sum of all odd Fibonacci numbers that are less than or equal to `num`.
+
The first two numbers in the Fibonacci sequence are 1 and 1. Every additional number in the sequence is the sum of the two previous numbers. The first six numbers of the Fibonacci sequence are 1, 1, 2, 3, 5 and 8.
-For example, sumFibs(10) should return 10 because all odd Fibonacci numbers less than or equal to 10 are 1, 1, 3, and 5.
-
-## Instructions
-
+For example, `sumFibs(10)` should return `10` because all odd Fibonacci numbers less than or equal to `10` are 1, 1, 3, and 5.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: sumFibs(1) should return a number.
- testString: assert(typeof sumFibs(1) === "number");
- - text: sumFibs(1000) should return 1785.
- testString: assert(sumFibs(1000) === 1785);
- - text: sumFibs(4000000) should return 4613732.
- testString: assert(sumFibs(4000000) === 4613732);
- - text: sumFibs(4) should return 5.
- testString: assert(sumFibs(4) === 5);
- - text: sumFibs(75024) should return 60696.
- testString: assert(sumFibs(75024) === 60696);
- - text: sumFibs(75025) should return 135721.
- testString: assert(sumFibs(75025) === 135721);
+`sumFibs(1)` should return a number.
+```js
+assert(typeof sumFibs(1) === 'number');
```
-
+`sumFibs(1000)` should return 1785.
-## Challenge Seed
-
+```js
+assert(sumFibs(1000) === 1785);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function sumFibs(num) {
@@ -76,5 +79,3 @@ function sumFibs(num) {
return s;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes.md
index dc7ee9c9a6..df47b2c140 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes.md
@@ -5,43 +5,35 @@ challengeType: 5
forumTopicId: 16085
---
-## Description
-
+# --description--
-A prime number is a whole number greater than 1 with exactly two divisors: 1 and
-itself. For example, 2 is a prime number because it is only divisible by 1 and 2. In
-contrast, 4 is not prime since it is divisible by 1, 2 and 4.
+A prime number is a whole number greater than 1 with exactly two divisors: 1 and itself. For example, 2 is a prime number because it is only divisible by 1 and 2. In contrast, 4 is not prime since it is divisible by 1, 2 and 4.
-Rewrite `sumPrimes` so it returns the sum of all prime numbers that are less than or
-equal to num.
+Rewrite `sumPrimes` so it returns the sum of all prime numbers that are less than or equal to num.
-
+# --hints--
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: sumPrimes(10) should return a number.
- testString: assert.deepEqual(typeof sumPrimes(10), 'number');
- - text: sumPrimes(10) should return 17.
- testString: assert.deepEqual(sumPrimes(10), 17);
- - text: sumPrimes(977) should return 73156.
- testString: assert.deepEqual(sumPrimes(977), 73156);
+`sumPrimes(10)` should return a number.
+```js
+assert.deepEqual(typeof sumPrimes(10), 'number');
```
-
+`sumPrimes(10)` should return 17.
-## Challenge Seed
-
+```js
+assert.deepEqual(sumPrimes(10), 17);
+```
-
+`sumPrimes(977)` should return 73156.
+
+```js
+assert.deepEqual(sumPrimes(977), 73156);
+```
+
+# --seed--
+
+## --seed-contents--
```js
function sumPrimes(num) {
@@ -51,15 +43,7 @@ function sumPrimes(num) {
sumPrimes(10);
```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function eratosthenesArray(n) {
@@ -88,5 +72,3 @@ function sumPrimes(num) {
sumPrimes(10);
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md
index 9ad14eb338..cdd8737edf 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.md
@@ -5,43 +5,100 @@ challengeType: 5
forumTopicId: 16092
---
-## Description
-
+# --description--
+
Make a function that looks through an array of objects (first argument) and returns an array of all objects that have matching name and value pairs (second argument). Each name and value pair of the source object has to be present in the object from the collection if it is to be included in the returned array.
-For example, if the first argument is [{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], and the second argument is { last: "Capulet" }, then you must return the third object from the array (the first argument), because it contains the name and its value, that was passed on as the second argument.
-
-## Instructions
-
+For example, if the first argument is `[{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }]`, and the second argument is `{ last: "Capulet" }`, then you must return the third object from the array (the first argument), because it contains the name and its value, that was passed on as the second argument.
-
+# --hints--
-## Tests
-
-
-```yml
-tests:
- - text: 'whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" }) should return [{ first: "Tybalt", last: "Capulet" }].'
- testString: 'assert.deepEqual(whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" }), [{ first: "Tybalt", last: "Capulet" }]);'
- - text: 'whatIsInAName([{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }], { "apple": 1 }) should return [{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }].'
- testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }], { "apple": 1 }), [{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }]);'
- - text: 'whatIsInAName([{ "apple": 1, "bat": 2 }, { "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "bat": 2 }) should return [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }].'
- testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1, "bat": 2 }, { "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "bat": 2 }), [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }]);'
- - text: 'whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "cookie": 2 }) should return [{ "apple": 1, "bat": 2, "cookie": 2 }].'
- testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "cookie": 2 }), [{ "apple": 1, "bat": 2, "cookie": 2 }]);'
- - text: 'whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }, { "bat":2 }], { "apple": 1, "bat": 2 }) should return [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie":2 }].'
- testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }, {"bat":2}], { "apple": 1, "bat": 2 }), [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie":2 }]);'
- - text: 'whatIsInAName([{"a": 1, "b": 2, "c": 3}], {"a": 1, "b": 9999, "c": 3}) should return []'
- testString: 'assert.deepEqual(whatIsInAName([{ "a": 1, "b": 2, "c": 3 }], { "a": 1, "b": 9999, "c": 3 }), []);'
+`whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" })` should return `[{ first: "Tybalt", last: "Capulet" }]`.
+```js
+assert.deepEqual(
+ whatIsInAName(
+ [
+ { first: 'Romeo', last: 'Montague' },
+ { first: 'Mercutio', last: null },
+ { first: 'Tybalt', last: 'Capulet' }
+ ],
+ { last: 'Capulet' }
+ ),
+ [{ first: 'Tybalt', last: 'Capulet' }]
+);
```
-
+`whatIsInAName([{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }], { "apple": 1 })` should return `[{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }]`.
-## Challenge Seed
-
+```js
+assert.deepEqual(
+ whatIsInAName([{ apple: 1 }, { apple: 1 }, { apple: 1, bat: 2 }], {
+ apple: 1
+ }),
+ [{ apple: 1 }, { apple: 1 }, { apple: 1, bat: 2 }]
+);
+```
-
-
-
-
-
-
-## Solution
-
-
+# --solutions--
```js
function whatIsInAName(collection, source) {
@@ -78,5 +127,3 @@ function whatIsInAName(collection, source) {
return arr;
}
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-001.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-001.md
index af5432e635..2414841ab5 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-001.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-001.md
@@ -4,54 +4,25 @@ title: Part 1
challengeType: 0
---
-## Description
-
+# --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--
-
-
-
-## Instructions
-
-
-
-
-## Tests
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(code.replace(/\s/g, '').match(/console\.log\(document\)/));
+See description above for instructions.
+```js
+assert(code.replace(/\s/g, '').match(/console\.log\(document\)/));
```
-
+# --seed--
-
-## Challenge Seed
-
-
-
+## --seed-contents--
-
+```html
+
+```
-## Solution
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-002.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-002.md
index 5d0f71d413..11d4b3821d 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-002.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-002.md
@@ -4,9 +4,7 @@ title: Part 2
challengeType: 0
---
-## Description
-
-
+# --description--
In our HTML document, we have a form element with an `id` attribute: `
`
@@ -14,42 +12,21 @@ To reference and access this particular form in JavaScript, we can use the getEl
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`.
-
+## --seed-contents--
-
+```html
+
+```
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-003.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-003.md
index f6d6128010..6dbd4e3731 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-003.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-003.md
@@ -4,9 +4,7 @@ title: Part 3
challengeType: 0
---
-## Description
-
-
+# --description--
Now we need to specify what should be done with the form when the user submits it by clicking the Calculate button.
@@ -18,42 +16,23 @@ Assign a function named `calculate` to the `onsubmit` event of your form.
You will create the `calculate` function later.
-
+# --hints--
-## Instructions
+See description above for instructions.
-
-
-
-## Tests
-
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert( code.replace(/\s/g, '').match(/document\.getElementById\([\'\"\`]calorie\-form[\'\"\`]\)\.onsubmit\=calculate/) );
+```js
+assert(
+ code
+ .replace(/\s/g, '')
+ .match(
+ /document\.getElementById\([\'\"\`]calorie\-form[\'\"\`]\)\.onsubmit\=calculate/
+ )
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
+## --seed-contents--
-
+```html
+
+```
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-004.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-004.md
index a29b678ec1..f92bdc5f2c 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-004.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-004.md
@@ -4,53 +4,25 @@ title: Part 4
challengeType: 0
---
-## Description
+# --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`:
+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--
-## Instructions
+See description above for instructions.
-
-
-
-## Tests
-
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert( typeof calculate === "function" );
+```js
+assert(typeof calculate === 'function');
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
+## --seed-contents--
-
+```html
+
+```
-## Solution
-
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-005.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-005.md
index 81b8062486..a1cccd3b63 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-005.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-005.md
@@ -4,13 +4,9 @@ title: Part 5
challengeType: 0
---
-## Description
+# --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.
+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:
@@ -18,44 +14,17 @@ Here is an example of an empty function called `square` that takes a `number` as
function square(number) {}
```
-
+# --hints--
-## Instructions
+See description above for instructions.
-
-
-
-## Tests
-
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(calculate.toString().match(/function calculate\(\s*e\)\s*\{\s*\}/));
+```js
+assert(calculate.toString().match(/function calculate\(\s*e\)\s*\{\s*\}/));
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
+## --seed-contents--
-
+```html
+
+```
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-006.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-006.md
index d41de4a78e..3062fd3166 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-006.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-006.md
@@ -4,52 +4,23 @@ title: Part 6
challengeType: 0
---
-## Description
-
-
+# --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--
-## Instructions
+See description above for instructions.
-
-
-
-## Tests
-
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(calculate.toString().match(/e\.preventDefault\(\s*\)/));
+```js
+assert(calculate.toString().match(/e\.preventDefault\(\s*\)/));
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
+## --seed-contents--
-
+```html
+
+```
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-007.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-007.md
index c788240b5b..3f80f08256 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-007.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-007.md
@@ -4,9 +4,7 @@ title: Part 7
challengeType: 0
---
-## Description
-
-
+# --description--
If you inspect the inputs in the form, you will notice that they have the class name `cal-control`.
@@ -14,46 +12,21 @@ To access elements with a certain class name, we use the `getElementsByClassName
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--
-## Instructions
+See description above for instructions.
-
-
-
-## Tests
-
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert( code.replace(/\s/g, '').match(/document\.getElementsByClassName\([\'\"\`]cal\-control[\'\"\`]\)/) );
+```js
+assert(
+ code
+ .replace(/\s/g, '')
+ .match(/document\.getElementsByClassName\([\'\"\`]cal\-control[\'\"\`]\)/)
+);
```
-
+# --seed--
-## Challenge Seed
-
-
-
-
+## --seed-contents--
-
+```html
+
+```
-
+# --solutions--
```html
```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-010.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-010.md
index 424bd2977d..066b97fa37 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-010.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/intermediate-javascript-calorie-counter/part-010.md
@@ -4,53 +4,21 @@ title: Part 10
challengeType: 0
---
-## Description
-
-
+# --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--
-## Instructions
+See description above for instructions.
-
-
-
-## Tests
-
-
-
-```yml
-tests:
- - text: See description above for instructions.
- testString: assert(/const\s*meal\s*=\s*total\[0\]/.test(code));
+```js
+assert(/const\s*meal\s*=\s*total\[0\]/.test(code));
```
-
+# --seed--
-## Challenge Seed
-
-
-
-