Challenge says to clear browser console, but i did and it still wont pass

Tell us what’s happening:
I’m using firefox browser and have used the console. I ran the console.log, then the console.clear and console.log… the challenge tells me to clear browser console, but I did and it is clear. any ideas why I can’t pass this challenge?

Your code so far


// Open your browser console.
let output = "Get this to log once in the freeCodeCamp console and twice in the browser console";
// Use console.log() to print the output variable.
console.clear(output);
console.log(output);
// Run the tests to see the difference between the two consoles.

// Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0.

Challenge: Understanding the Differences between the freeCodeCamp and Browser Console

Link to the challenge:

First, use console.log to log the output variable. Then, use console.clear to clear the browser console.

If you look at both the instructions in the challenge and the comments in the editor, it tells you what order to do things in.

ive tried log then clear, clear then log, log followed by clear on same line, clear followed by log on same line…still not passing. console says “console cleared”, still not working.

If you share your code, we can try to help you figure out what is wrong with it.

what code do you need? free code camp or browser console?

On browser,I hit enter after each console code, then it ends up cleared and there is no code

The code that you are trying to submit for the challenge.

first… let output = “Get this to log once in the freeCodeCamp console and twice in the browser console”;

then… console.log(output);

then… console.clear(output);

then… all different permutations of log and clear… still not passing. scratching my head

Ok, what are all of the permutations you are trying? There is a single correct permutation out of the two possible permutations of those two lines :laughing:

console.log(output); … enter

console.clear(output); … enter

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

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

Can you paste the actual literal code you are submitting without adding the “… enter” business please?

i don’t know what more you’re asking for. That is exactly as i input it into the browser console. I only put “enter” so you see where i hit enter after each entry of code.


What are you literally typing into the area on the right? That is the only thing that the freeCodeCamp test suite can test.

let output = "Get this to log once in the freeCodeCamp console and twice in the browser console";

// Use console.log() to print the output variable.

console.clear(output);

console.log(output);

// Run the tests to see the difference between the two consoles.

// Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.

As @ArielLeslie said, these two lines are in the wrong order.


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like
let output = "Get this to log once in the freeCodeCamp console and twice in the browser console";
// Use console.log() to print the output variable.

console.log(output);
console.clear(output);
// Run the tests to see the difference between the two consoles.

// Now, add console.clear() before your console.log() to clear the browser console, and pass the tests.

still not passing

You are close. console.clear() does not take any arguments.

1 Like

WOW!!! it was that simple? thank you both for the prompt attention and help. Thank you so much!

1 Like