mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-12 10:00:39 -04:00
fix(curriculum) - remove console.log(data) from step 9 and above for the leaderboard project (#52961)
This commit is contained in:
@@ -253,7 +253,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ Call the `showLatestPosts()` function at the end of your `try` block and pass in
|
||||
You should call `showLatestPosts()` at the end of your `try` block.
|
||||
|
||||
```js
|
||||
assert.match(code, /\s*console\.log\(data\);?\s*showLatestPosts\(.*\);??\s*/);
|
||||
assert.match(code, /\s*showLatestPosts\(.*\);??\s*/);
|
||||
```
|
||||
|
||||
You should pass `data` as the argument to `showLatestsPosts()`.
|
||||
|
||||
```js
|
||||
assert.match(code, /\s*console\.log\(data\);?\s*showLatestPosts\(data\);?\s*/);
|
||||
assert.match(code, /\s*showLatestPosts\(data\);?\s*/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -242,8 +242,7 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
|
||||
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
@@ -233,7 +233,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -235,7 +235,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -255,7 +255,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -242,7 +242,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -241,7 +241,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -233,7 +233,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -248,7 +248,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -237,7 +237,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -233,7 +233,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -263,7 +263,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -245,7 +245,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -246,7 +246,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -247,7 +247,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -248,7 +248,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -249,7 +249,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -251,7 +251,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -252,7 +252,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -269,7 +269,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -271,7 +271,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -269,7 +269,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -257,7 +257,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -285,7 +285,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -267,7 +267,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -281,7 +281,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -267,7 +267,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -265,7 +265,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -290,7 +290,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -288,7 +288,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -283,7 +283,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -286,7 +286,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -307,7 +307,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -292,7 +292,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -307,7 +307,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -308,7 +308,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -301,7 +301,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -311,7 +311,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -311,7 +311,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -330,7 +330,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -301,7 +301,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -310,7 +310,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -312,7 +312,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -328,7 +328,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -307,7 +307,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -325,7 +325,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -322,7 +322,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -353,7 +353,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -321,7 +321,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -323,7 +323,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -323,7 +323,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -318,7 +318,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -321,7 +321,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
@@ -664,7 +663,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -239,7 +239,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -11,6 +11,8 @@ If there is an error from the `fetch` call, the `catch` block will handle it.
|
||||
|
||||
Inside the `catch` block, add a `console.log` to log the `err` parameter.
|
||||
|
||||
Also, remove your `console.log(data);` from your `try` block now that you understand what is being returned from the `fetch` call.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should use `console.log` to log the `err` variable.
|
||||
@@ -25,6 +27,12 @@ Your `console.log` should be inside the `catch` block.
|
||||
assert.match(code, /\s*try\s*{[^}]*\s*}\s*catch\s*\(\s*err\s*\)\s*{[^}]*\s*console\.log\(\s*err\s*\)[^}]*}/);
|
||||
```
|
||||
|
||||
You should remove `console.log(data);` from the `try` block.
|
||||
|
||||
```js
|
||||
assert.notMatch(code, /\s*console\.log\(\s*data\s*\)/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
@@ -276,7 +276,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -303,7 +303,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -306,7 +306,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -307,7 +307,6 @@ const fetchData = async () => {
|
||||
try {
|
||||
const res = await fetch(forumLatest);
|
||||
const data = await res.json();
|
||||
console.log(data);
|
||||
showLatestPosts(data);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
Reference in New Issue
Block a user