console.log()
statements the exact number of times you requested.
The freeCodeCamp console will print your console.log()
statements for each test of that challenge, as well as one more time for any function calls that you have in your code.
This lends itself to some interesting behavior and might trip you up in the beginning, because a logged value that you expect to see only once may print out many more times.
If you would like to see only your single output and not have to worry about running through the test cycles, you can use console.clear()
and check the browsers console.
console.clear()
to clear the browser console. After that, use console.log
to log the output
variable.
console.clear()
to clear the browser console.
testString: const removeJSComments = code.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, ''); const noSpaces = removeJSComments.replace(/\s/g, ''); assert(noSpaces.match(/console.clear\(\)/));
- text: You should use console.log()
to print the output
variable.
testString: const noSpaces = code.replace(/\s/g, ''); assert(noSpaces.match(/console\.log\(output\)/));
```