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.

Basic JavaScript: Multiple Identical Options in Switch Statements

See original GitHub issue

Describe your problem and how to reproduce it: The example shows

switch(val) {
  case 1:
  case 2:
  case 3:
    result = "1, 2, or 3";
    break;
  case 4:
    result = "4 alone";
}

Should not have result should show return with the example this is in basic javascript, this could be confusing for the user new to javascript to think they should use result and not return for output.

Add a Link to the page with the problem:

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements

Tell us about your browser and operating system:

  • Browser Name: Firefox
  • Browser Version: 81.0.2
  • Operating System: OSX Catalina

If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box): Screen Shot 2020-10-19 at 7 45 49 AM

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
naomi-lgbtcommented, Oct 19, 2020

I took a quick peek at those forum posts - the first one seems to come from trying to condense the case statements (which the tests ask specifically for 9 distinct statements). The rest come from following the example too closely and missing the change in variable names.

I do agree that these suggestions would alleviate that - but at the same time, we have a number of examples that do not directly match what the tests look for. And I fully support that, as it discourages blindly following the example and encourages the camper to think about how the example works.

0reactions
Tracy-emcommented, Nov 9, 2020

Hiền SôKiu

Vào 15:55, Th 2, ngày 09 tháng 11 năm 2020 rajapandi_vijayakumar < notifications@github.com> đã viết:

I would like to take up this issue fix.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/freeCodeCamp/freeCodeCamp/issues/40032#issuecomment-723865330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOV6MWFUHLB5CC6WZJRAH6DSO6U6ZANCNFSM4SWDEVUA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Identical Options in Switch Statements - GitHub
Multiple Identical Options in Switch Statements ... Cases for 1, 2, and 3 will all produce the same result. Instructions. Write a switch...
Read more >
Multiple Identical Options in Switch Statements. help - JavaScript
You can't put that kind of logic inside of switch statements. Your cases evaluate to either true or false then you are comparing...
Read more >
Multiple Identical Options in Switch Statements - Stack Overflow
It's the first time I'm using switch statements in Javascript and I've found a lot of difficulties while learning this through FreeCodeCamp.
Read more >
FCC - Multiple Identical Options in Switch Statements - CodePen
1. <!-- If the break statement is omitted from a switch statement's case, the following case statement(s) are executed until a break is...
Read more >
Multiple Identical Options in Switch Statements - Scrimba.com
Our courses and tutorials will teach you React, Vue, Angular, JavaScript, HTML, CSS, and more. Scrimba is the fun and easy way to...
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