question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Console capture does not log when message is falsy

See original GitHub issue

Challenge Passing Values to Functions with Arguments has an issue. User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36 OPR/41.0.2353.69.

Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:


// Example
// Only change code below this line.

function functionWithArgs(c, d) {
 console.log(c + d); 
}
functionWithArgs(7,-7); // result is 'console.log never called '

Result should be 0, but is not. 



Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
systimoticcommented, Dec 2, 2016

What’s interesting to me is that most of the following challenges (global scope challenge and the local scope challenge) don’t verify the message at all, nor stringify it. The message “console.log was never called” is never shown because of the seed, so it’s a bit weird that it even exists. I think it would be a good idea to make sure it’s consistent for all challenges where it is used, if that’s possible.

1reaction
abhisekpcommented, Nov 29, 2016

Ah! Your hunch is right 😃 @erictleung This line https://github.com/FreeCodeCamp/FreeCodeCamp/blob/staging/seed/challenges/01-front-end-development-certification/basic-javascript.json#L2358 should read

logOutput = JSON.stringify(message).trim();",

The if statement is unnecessary.

When message == 0, it won’t output anything. 🙅‍♂️ according to https://github.com/FreeCodeCamp/FreeCodeCamp/blob/staging/seed/challenges/01-front-end-development-certification/basic-javascript.json#L2308

Read more comments on GitHub >

github_iconTop Results From Across the Web

console.log does not output when running tests #2441 - GitHub
I would expect to have console.log always output while my tests are ... tests pass/fail properly - just console.log messages do not show...
Read more >
Console.log statements output nothing at all in Jest
Run console.debug('Message here', yourValueHere) inside test function and it should show in the console output when running test script. You can ...
Read more >
Capture Console Logs - LogRocket Docs
By default, all methods will be logged unless explicitly set to false. Disabling specific console logging methods. // This will log all console.info,...
Read more >
JavaScript Console.log() Example – How to Print to the ...
If the first argument is false, then the message will be logged. If we were to change isItWorking to true , then the...
Read more >
Logging and Trace - Liberty - IBM
The logging component does not capture or control the destination of messages that are written directly by the JVM process, such as -verbose:gc...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found