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.

Minor - Output neither captured nor used

See original GitHub issue

Describe your problem and how to reproduce it: For Basic JavaScript: Selecting from Many Options with Switch Statements, its a bit weird that caseInSwitch(1); is called but the output is not captured or used.

let result = caseInSwitch(1);

or

console.log(caseInSwitch(1)):

would be more typical.

See discussion here: https://www.freecodecamp.org/forum/t/basic-javascript-selecting-from-many-options-with-switch-statements-problem/404022/4

Add a Link to the page with the problem: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements

Tell us about your browser and operating system:

  • Browser Name: Firefox
  • Browser Version: 77.0.1
  • Operating System: Arch Linux

If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box):

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
lasjorgcommented, Jun 17, 2020

I think it’s a good idea to have the function call. It shows how the function is called and what arguments are passed to the function without having to look at the test cases.

But I agree it would be better to use the return value.

Wrapping function calls in console logs can confuse some new learners just a bit I think. Capturing the return and logging it is more verbose but also more explicit about the function having a return value and it allows for the use of a variable name that may help “document” the code.

const returnAnswer = caseInSwitch(1);
console.log(returnAnswer);
1reaction
RandellDawsoncommented, Jun 24, 2020

Quite a while back we purposely removed most (I thought all) console.log statements that appeared after a function. The idea was if the user wanted use a console.log statement, then that was their choice. They do learn about them at some point in the curriculum. I believe we should not have console.log statements by default on these challenges until we have introduced them (Debugging section).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Output input from previous time step - Simulink - MathWorks
When the Memory block inherits a discrete sample time, the block is analogous to the Unit Delay block. However, the Memory block does...
Read more >
Configure and Capture Embedded Packet on Software - Cisco
This document describes the Embedded Packet Capture (EPC) feature in Cisco IOS® software.
Read more >
Input & output devices | AP CSP (article) - Khan Academy
There are hundreds of other input devices, like microphones to capture sound waves, ... Identify whether each accessory is a computer "input" or...
Read more >
External Pacemaker - StatPearls - NCBI Bookshelf
External Pacing is the fastest available method to synchronize cardiac rhythm in all the bradyarrhythmias indicated by the American Heart ...
Read more >
Input and Output - Computer Terminology
On either type of computer you can also use mice with three or more buttons and a small scroll wheel (which can also...
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