mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-25 02:14:11 -05:00
chore(curriculum): fixed inaccuracies and added code tags in fcc author page new JS project (#50247)
fixed typos and added code tags
This commit is contained in:
@@ -21,7 +21,7 @@ You should use `document.getElementById()` to get the `#author-container` elemen
|
||||
assert.match(code, /document\.getElementById\(\s*('|"|`)author\-container\1\)/);
|
||||
```
|
||||
|
||||
You should assign the `#authorContainer` element to the variable `authorContainer`. Don't forget to use `const` to declare the variable.
|
||||
You should assign the `#author-container` element to the variable `authorContainer`. Don't forget to use `const` to declare the variable.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+authorContainer\s*\=\s*document\.getElementById\(\s*('|"|`)author\-container\1\)/);
|
||||
|
||||
@@ -54,7 +54,7 @@ You should log the `res` parameter to the console so you can see the `Response`
|
||||
assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\(?res\)?\s*=>\s*console\.log\(res\)\)/)
|
||||
```
|
||||
|
||||
You should have a semi-colon after your `.then()`.
|
||||
You should not have a semi-colon after your `.then()`.
|
||||
|
||||
```js
|
||||
assert.notMatch(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\(?res\)?\s*=>\s*console\.log\(res\)\);/)
|
||||
|
||||
@@ -7,7 +7,7 @@ dashedName: step-25
|
||||
|
||||
# --description--
|
||||
|
||||
If this condition is met, disable the button by setting its `disabled` property to `true`. Also, set the text content of the button to `No more data to load`.
|
||||
If this condition is met, disable the button by setting its `disabled` property to `true`. Also, set the `textContent` of the button to `No more data to load`.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ dashedName: step-28
|
||||
|
||||
Finally, what if there's an error and the author data fail to load? Then we need to show an error in the UI. That's exactly what the `.catch()` method is for – handling errors.
|
||||
|
||||
Inside the `.catch()`, remove the `console.error()` and set the `innerHTML` of the author container to a `p` element with the `class` `error-msg` and text `There was an error loading the authors`.
|
||||
Inside the `.catch()`, remove the `console.error()` and set the `innerHTML` of the `authorContainer` to a `p` element with the `class` `error-msg` and text `There was an error loading the authors`.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user