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.

[BETA]: Debugging: Differences b/w FCC & Browser Console (Lesson doesn't match output, one test might be passing erroneously)

See original GitHub issue

Challenge Name

https://beta.freecodecamp.org/en/challenges/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console

Issue Description

  1. The lesson states (excerpting for brevity):

When you load and run an ordinary JavaScript file in your browser the console.log() statements will print exactly what you tell them to print to the browser console the exact number of times you requested.

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 depending on the number of tests and the values being passed to those tests.

The editor text says:

// 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);

However, Firefox & Chrome browser consoles both exhibit the same behavior, only printing the line once (see screenshots). I specifically left out the clear.console() line to see the duplicated console output, but it doesn’t work.

  1. The tests pass whether clear.console() is written in the editor or not. (screenshot below)

Browser Information

  • Browser Name, Version: Firefox 59.0.1 && Chrome 65.0.3325.181
  • Operating System: Win 8.1, 64-bit
  • Mobile, Desktop, or Tablet: Desktop

Your Code

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

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

Screenshot

PROBLEM#1: Firefox Console: image

Chrome Console: image

PROBLEM#2 image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
iabrennecommented, May 9, 2018

Thank you, @raisedadead . I am looking into the console.log issue now to see if we can get FCC browser console to show console.log output, as advertised 😃

0reactions
raisedadeadcommented, Aug 28, 2019

My bad, I mistook this for a client implementation of the same. Ignore my last.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The 16 JavaScript debugging tips you probably didn't know
1. debugger. After console.log, debugger is my favorite quick and dirty debugging tool. If you place a debugger; line in your code, Chrome ......
Read more >
CS 312 Lecture 26 Debugging Techniques
But if the output for one of the test cases is not the one expected, then the program is incorrect -- it contains...
Read more >
Test and Debug Your Custom Skill | Alexa Skills Kit
Follow these recommendations to test custom skills. Before you start testing, complete the steps to verify the minimum configuration and deploy your skill....
Read more >
console.log() shows the changed value of a variable before ...
Console.log() is passed a reference to the object, so the value in the Console changes as the object changes. To avoid that you...
Read more >
Catatan Perubahan — dokumentasi Python 3.5.10 - Python Docs
bpo-36816: Update Lib/test/selfsigned_pythontestdotnet.pem to match ... Fixed possible other errors caused by not checking results of PyObject_Size(), ...
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