Files
freeCodeCamp/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md
Tom cfbc7e9283 fix(curriculum): console not repsonding properly issue (#43053)
* fix(curriculum): console not repsonding properly issue

* fix: refine instructions

* fix: add a test + reword to remove seed comments

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>

* fix: remove comments from dictionary

* fix: remove comments from i18n dictionaries

* Revert "fix: remove comments from dictionary"

This reverts commit 7f76d5a8ec.

* Revert "fix: remove comments from i18n dictionaries"

This reverts commit 54b1c12cfc.

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
2021-08-27 17:57:08 +02:00

66 lines
2.0 KiB
Markdown

---
id: 587d7b83367417b2b2512b37
title: Understanding the Differences between the freeCodeCamp and Browser Console
challengeType: 1
forumTopicId: 301193
dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-console
---
# --description--
You may have noticed that some freeCodeCamp challenges include their own console. This console behaves a little differently than the browser console.
There are many methods to use with `console` to output messages. `log`, `warn`, and `clear` to name a few. The freeCodeCamp console will only output `log` messages, while the browser console will output all messages. When you make changes to your code, it will automatically run and show the logs. The freeCodeCamp console is then cleared each time your code runs.
# --instructions--
First, open your browser console so you can see the logs. To do that, you can right-click the freeCodeCamp navigation bar at the top and click `inspect` on most browsers. Then find the `console` tab in the window that opens.
After that, use `console.log` to log the `output` variable. View the two consoles to see the log. Finally, use `console.clear` after your log to clear the browser console. View the difference in the two consoles.
# --hints--
You should use `console.log()` to print the `output` variable.
```js
assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));
```
You should use `console.clear()` to clear the browser console.
```js
assert(
__helpers
.removeWhiteSpace(code)
.match(/console.clear\(\)/)
);
```
You should clear the console after your log.
```js
assert(
__helpers
.removeWhiteSpace(code)
.match(/console\.log\(output\)[\s\S]*console.clear\(\)/)
);
```
# --seed--
## --seed-contents--
```js
let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";
```
# --solutions--
```js
let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";
console.log(output);
console.clear();
```