Skip to main content

--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.

assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/));

You should use console.clear() to clear the browser console.

assert(
__helpers
.removeWhiteSpace(__helpers.removeJSComments(code))
.match(/console.clear\(\)/)
);

You should clear the console after your log.

assert(
__helpers
.removeWhiteSpace(__helpers.removeJSComments(code))
.match(/console\.log\(output\)[\s\S]*console.clear\(\)/)
);

--seed--

--seed-contents--

let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";

--solutions--

let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";

console.log(output);
console.clear();