Understanding the Differences between the freeCodeCamp and Browser Console

Understanding the Differences between the freeCodeCamp and Browser Console
0

#1

I’ve been trying his problem for a quite long time now. I’m getting “invalid regexp group”. Can anyone give me a hint? Should this be happening?


// Open your browser console
let outputTwo = "This will print to the browser console 2 times";
// Use console.log() to print the outputTwo variable
console.log(outputTwo);

let outputOne = "Try to get this to log only once to the browser console";
// Use console.clear() in the next line to print the outputOne only once
console.clear();

// Use console.log() to print the outputOne variable
console.log(outputOne);

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console


#2

I can’t reproduce that error. Are you by any chance using Edge or Safari?

Bugs should always be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.


#3

Same problem here… :wink:


#4

There is an issue here regarding this problem.


#5

I think I found the solution…
Write the code that you wrote there but do not use semi-colons.


#6

What is the reason for “printing it out twice”?!
and why do you have to define an argument for console log, but not for console clear?! and how are you supposed to know that console clear doesn’t need an argument? Another terribly explained exercise…


#7

Because when the run the tests it prints out for each test. You’ll have some lessons where it prints more times.


#8


#9

Mine got hung up on having the comment on the same line as the semicolon.

// Open your browser console
let outputTwo = "This will print to the browser console 2 times";
console.log(outputTwo);// to print the outputTwo variable


let outputOne = "Try to get this to log only once to the browser console";
 console.clear(); // Use the next line to print the outputOne only once


// Use console.log() to print the outputOne variable
console.log(outputOne);