mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-25 02:14:11 -05:00
chore(curriculum): fCC Forum Leaderboard add quotes to strings (#55699)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
@@ -9,7 +9,7 @@ dashedName: step-19
|
||||
|
||||
To display the topic title, add a `p` element inside the first `td` element.
|
||||
|
||||
Between the paragraph tags, add an embedded expression that contains the `title` variable. Then add a class called `post-title` inside the opening paragraph tag.
|
||||
Between the paragraph tags, add an embedded expression that contains the `title` variable. Then add a class called `"post-title"` inside the opening paragraph tag.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -19,7 +19,7 @@ You should have a `p` element inside the first `td` element.
|
||||
assert(/return\s*`\s*<tr>\s*<td>\s*\S*\s*<p.*>\s*.*\s*<\/p>\s*\S*\s*<\/td>\s*<td>.*<\/td>\s*<td>\s*\S*\s*<\/td>\s*<td>.*<\/td>\s*<td>.*<\/td>\s*<\/tr>\s*`/.test(code));
|
||||
```
|
||||
|
||||
You should have a class named `post-title` inside the opening `p` tag.
|
||||
You should have a class named `"post-title"` inside the opening `p` tag.
|
||||
|
||||
```js
|
||||
assert(/return\s*`\s*<tr>\s*<td>\s*\S*\s*<p[^>]*class\s*=\s*('|")\s*post-title\s*\1[^>]*>.*<\/p>\s*\S*\s*<\/td>\s*<td>.*<\/td>\s*<td>\s*\S*\s*<\/td>\s*<td>.*<\/td>\s*<td>.*<\/td>\s*<\/tr>\s*`/.test(code));
|
||||
|
||||
@@ -11,9 +11,9 @@ For your `timeAgo` function, you will want to calculate the difference between t
|
||||
|
||||
Complete the `timeAgo` function that meets the following requirements:
|
||||
|
||||
- If the amount of minutes that have passed is less than `60`, return the string `xm ago`. `x` will represent the minutes.
|
||||
- If the amount of hours that have passed is less than `24`, return the string `xh ago`. `x` will represent the hours.
|
||||
- Otherwise, return the string `xd ago`. `x` will represent the days.
|
||||
- If the amount of minutes that have passed is less than `60`, return the string `"xm ago"`. `x` will represent the minutes.
|
||||
- If the amount of hours that have passed is less than `24`, return the string `"xh ago"`. `x` will represent the hours.
|
||||
- Otherwise, return the string `"xd ago"`. `x` will represent the days.
|
||||
|
||||
Here are some equations that will help you calculate the time difference:
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ Create a `viewCount` function with a `views` parameter. If `views` is greater th
|
||||
|
||||
Otherwise, return the `views` value.
|
||||
|
||||
For example, if `views` is `1000` your return value should be the string `1k`.
|
||||
For example, if `views` is `1000` your return value should be the string `"1k"`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -29,13 +29,13 @@ Your `viewCount` function should have a parameter called `views`.
|
||||
assert.match(viewCount.toString(), /\(?views\)?/);
|
||||
```
|
||||
|
||||
Your `viewCount` function should return the string `1k` when `views` is `1000`.
|
||||
Your `viewCount` function should return the string `"1k"` when `views` is `1000`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(viewCount(1000), "1k");
|
||||
```
|
||||
|
||||
Your `viewCount` function should return the string `100k` when `views` is `100000`.
|
||||
Your `viewCount` function should return the string `"100k"` when `views` is `100000`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(viewCount(100000), "100k");
|
||||
|
||||
@@ -7,21 +7,21 @@ dashedName: step-37
|
||||
|
||||
# --description--
|
||||
|
||||
Inside your `else` clause, assign the string `general` to `selectedCategory.className`.
|
||||
Inside your `else` clause, assign the string `"general"` to `selectedCategory.className`.
|
||||
|
||||
Below that, assign the string `General` to `selectedCategory.category`.
|
||||
Below that, assign the string `"General"` to `selectedCategory.category`.
|
||||
|
||||
Lastly, assign the number `1` to `selectedCategory.id`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should assign the string `general` to `selectedCategory.className`.
|
||||
You should assign the string `"general"` to `selectedCategory.className`.
|
||||
|
||||
```js
|
||||
assert.match(code, /selectedCategory\.className\s*=\s*('|"|`)general\1/);
|
||||
```
|
||||
|
||||
You should assign the string `General` to `selectedCategory.category`.
|
||||
You should assign the string `"General"` to `selectedCategory.category`.
|
||||
|
||||
```js
|
||||
assert.match(code, /selectedCategory\.category\s*=\s*('|"|`)General\1/);
|
||||
|
||||
@@ -9,7 +9,7 @@ dashedName: step-42
|
||||
|
||||
After the `href` attribute, set the `class` attribute to the constant named `linkClass`.
|
||||
|
||||
After the `class` attribute, set the `target` attribute to `_blank`.
|
||||
After the `class` attribute, set the `target` attribute to `"_blank"`.
|
||||
|
||||
Lastly, place the `linkText` constant in between the anchor tags to display the text in the link.
|
||||
|
||||
@@ -36,7 +36,7 @@ const anchorTagWithHrefClassAndTarget = /return\s+`<a[^>]*href\s*=\s*('|")[^'"]*
|
||||
assert(code.match(anchorTagWithHrefClassAndTarget));
|
||||
```
|
||||
|
||||
You should set the value of the `target` attribute to `_blank`.
|
||||
You should set the value of the `target` attribute to `"_blank"`.
|
||||
|
||||
```js
|
||||
const targetValue = /return\s+`<a[^>]*target\s*=\s*('|")_blank\1[^>]*>/g;
|
||||
|
||||
@@ -9,7 +9,7 @@ dashedName: step-52
|
||||
|
||||
For the remaining steps, you will add the functionality to display the user avatars.
|
||||
|
||||
Inside the second `td` element, add a `div` element with a class name of `avatar-container`.
|
||||
Inside the second `td` element, add a `div` element with a class name of `"avatar-container"`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -21,7 +21,7 @@ const divTest = /<div\b[^>]*>([\s\S]*?)<\/div>/gm;
|
||||
assert.match(secondTd?.split(/<\/td>/)?.[0], divTest);
|
||||
```
|
||||
|
||||
Your opening `div` tag should have a class attribute with the value of `avatar-container`.
|
||||
Your opening `div` tag should have a class attribute with the value of `"avatar-container"`.
|
||||
|
||||
```js
|
||||
const secondTd = code.split(/postsContainer\.innerHTML = topics\.map/)?.[1]?.split(/\s*<\/td>\s*<td>/)?.[1];
|
||||
|
||||
@@ -7,13 +7,13 @@ dashedName: step-55
|
||||
|
||||
# --description--
|
||||
|
||||
For the opening `a` tag, set the `target` attribute to `_blank`. Then, set the `href` attribute to `${forumTopicUrl}${slug}/${id}`.
|
||||
For the opening `a` tag, set the `target` attribute to `"_blank"`. Then, set the `href` attribute to `${forumTopicUrl}${slug}/${id}`.
|
||||
|
||||
And with those changes, your freeCodeCamp forum leaderboard project is now complete!
|
||||
|
||||
# --hints--
|
||||
|
||||
Your opening anchor tag should have a `target` attribute set to `_blank`.
|
||||
Your opening anchor tag should have a `target` attribute set to `"_blank"`.
|
||||
|
||||
```js
|
||||
const firstTd = code.split(/postsContainer\.innerHTML = topics\.map/)?.[1]?.split(/\s*<tr>\s*<td>/)?.[1];
|
||||
|
||||
@@ -10,9 +10,9 @@ demoType: onLoad
|
||||
|
||||
In this project, you will build a freeCodeCamp forum leaderboard that displays the latest topics, users, and replies from the [freeCodeCamp forum](https://forum.freecodecamp.org/). The HTML and CSS have been provided for you. Feel free to explore them.
|
||||
|
||||
When you are ready, use `const` to declare a `forumLatest` variable and assign it the string `https://cdn.freecodecamp.org/curriculum/forum-latest/latest.json`.
|
||||
When you are ready, use `const` to declare a `forumLatest` variable and assign it the string `"https://cdn.freecodecamp.org/curriculum/forum-latest/latest.json"`.
|
||||
|
||||
Below that, create another `const` variable called `forumTopicUrl` and assign it the string `https://forum.freecodecamp.org/t/`.
|
||||
Below that, create another `const` variable called `forumTopicUrl` and assign it the string `"https://forum.freecodecamp.org/t/"`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -22,7 +22,7 @@ You should declare a `forumLatest` variable with `const`.
|
||||
assert.match(code, /const\s+forumLatest\s*=/);
|
||||
```
|
||||
|
||||
You should assign `https://cdn.freecodecamp.org/curriculum/forum-latest/latest.json` to your `forumLatest` variable.
|
||||
You should assign `"https://cdn.freecodecamp.org/curriculum/forum-latest/latest.json"` to your `forumLatest` variable.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+forumLatest\s*=\s*('|")https:\/\/cdn\.freecodecamp\.org\/curriculum\/forum-latest\/latest\.json\1\s*/);
|
||||
@@ -34,7 +34,7 @@ You should declare a `forumTopicUrl` variable with `const`.
|
||||
assert.match(code, /const\s+forumTopicUrl\s*=/);
|
||||
```
|
||||
|
||||
You should assign `https://forum.freecodecamp.org/t/` to your `forumTopicUrl` variable.
|
||||
You should assign `"https://forum.freecodecamp.org/t/"` to your `forumTopicUrl` variable.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+forumTopicUrl\s*=\s*('|")https:\/\/forum\.freecodecamp\.org\/t\/\1\s*/);
|
||||
|
||||
@@ -7,9 +7,9 @@ dashedName: step-2
|
||||
|
||||
# --description--
|
||||
|
||||
Next, create a `const` variable called `forumCategoryUrl` and assign it the string `https://forum.freecodecamp.org/c/`.
|
||||
Next, create a `const` variable called `forumCategoryUrl` and assign it the string `"https://forum.freecodecamp.org/c/"`.
|
||||
|
||||
Below that, create another `const` variable called `avatarUrl` and assign it the string `https://sea1.discourse-cdn.com/freecodecamp`.
|
||||
Below that, create another `const` variable called `avatarUrl` and assign it the string `"https://sea1.discourse-cdn.com/freecodecamp"`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -19,7 +19,7 @@ You should declare a `forumCategoryUrl` variable with `const`.
|
||||
assert.match(code, /const\s+forumCategoryUrl\s*=/);
|
||||
```
|
||||
|
||||
You should assign `https://forum.freecodecamp.org/c/` to your `forumCategoryUrl` variable.
|
||||
You should assign `"https://forum.freecodecamp.org/c/"` to your `forumCategoryUrl` variable.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+forumCategoryUrl\s*=\s*('|")https:\/\/forum\.freecodecamp\.org\/c\/\1\s*/);
|
||||
@@ -31,7 +31,7 @@ You should declare an `avatarUrl` variable with `const`.
|
||||
assert.match(code, /const\s+avatarUrl\s*=/);
|
||||
```
|
||||
|
||||
You should assign `https://sea1.discourse-cdn.com/freecodecamp` to your `avatarUrl` variable.
|
||||
You should assign `"https://sea1.discourse-cdn.com/freecodecamp"` to your `avatarUrl` variable.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+avatarUrl\s*=\s*('|")https:\/\/sea1\.discourse-cdn\.com\/freecodecamp\1\s*/);
|
||||
|
||||
@@ -9,7 +9,7 @@ dashedName: step-28
|
||||
|
||||
Inside your `allCategories` object, add a new key for the number `299` with a value of an empty object.
|
||||
|
||||
Inside that object, add a property with a key of `category` and a string value of `Career Advice`. Below that property, add another key called `className` with a string value of `career`.
|
||||
Inside that object, add a property with a key of `category` and a string value of `"Career Advice"`. Below that property, add another key called `className` with a string value of `"career"`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -31,7 +31,7 @@ Your `299` object should have a `category` property.
|
||||
assert.property(allCategories['299'], 'category');
|
||||
```
|
||||
|
||||
Your `category` property should be set to the string `Career Advice`.
|
||||
Your `category` property should be set to the string `"Career Advice"`.
|
||||
|
||||
```js
|
||||
assert.equal(allCategories["299"].category, 'Career Advice');
|
||||
@@ -43,7 +43,7 @@ Your `299` object should have a `className` property.
|
||||
assert.property(allCategories['299'], 'className');
|
||||
```
|
||||
|
||||
Your `className` property should be set to the string `career`.
|
||||
Your `className` property should be set to the string `"career"`.
|
||||
|
||||
```js
|
||||
assert.equal(allCategories["299"].className, 'career');
|
||||
|
||||
@@ -9,9 +9,9 @@ dashedName: step-29
|
||||
|
||||
Add a new key for the number `409` with a value of an empty object.
|
||||
|
||||
Inside that object, add a property with a key of `category` and a string value of `Project Feedback`.
|
||||
Inside that object, add a property with a key of `category` and a string value of `"Project Feedback"`.
|
||||
|
||||
Below that property, add another key called `className` with a string value of `feedback`.
|
||||
Below that property, add another key called `className` with a string value of `"feedback"`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -33,7 +33,7 @@ Your `409` object should have a `category` property.
|
||||
assert.property(allCategories['409'], 'category');
|
||||
```
|
||||
|
||||
Your `category` property should be set to the string `Project Feedback`.
|
||||
Your `category` property should be set to the string `"Project Feedback"`.
|
||||
|
||||
```js
|
||||
assert.equal(allCategories["409"].category, 'Project Feedback');
|
||||
@@ -45,7 +45,7 @@ Your `409` object should have a `className` property.
|
||||
assert.property(allCategories['409'], 'className');
|
||||
```
|
||||
|
||||
Your `className` property should be set to the string `feedback`.
|
||||
Your `className` property should be set to the string `"feedback"`.
|
||||
|
||||
```js
|
||||
assert.equal(allCategories["409"].className, 'feedback');
|
||||
|
||||
@@ -9,9 +9,9 @@ dashedName: step-30
|
||||
|
||||
Add a new key for the number `417` with a value of an empty object.
|
||||
|
||||
Inside that object, add a property with a key of `category` and a string value of `freeCodeCamp Support`.
|
||||
Inside that object, add a property with a key of `category` and a string value of `"freeCodeCamp Support"`.
|
||||
|
||||
Below that property, add another key called `className` with a string value of `support`.
|
||||
Below that property, add another key called `className` with a string value of `"support"`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -33,7 +33,7 @@ Your `417` object should have a `category` property.
|
||||
assert.property(allCategories['417'], 'category');
|
||||
```
|
||||
|
||||
Your `category` property should be set to the string `freeCodeCamp Support`.
|
||||
Your `category` property should be set to the string `"freeCodeCamp Support"`.
|
||||
|
||||
```js
|
||||
assert.equal(allCategories["417"].category, 'freeCodeCamp Support');
|
||||
@@ -45,7 +45,7 @@ Your `417` object should have a `className` property.
|
||||
assert.property(allCategories['417'], 'className');
|
||||
```
|
||||
|
||||
Your `className` property should be set to the string `support`.
|
||||
Your `className` property should be set to the string `"support"`.
|
||||
|
||||
```js
|
||||
assert.equal(allCategories["417"].className, 'support');
|
||||
|
||||
Reference in New Issue
Block a user