Remove lowercase and uppercase from switch statement examples


I’m working my way through the JavaScript Algorithms and Data Structures course. I’ve previously completed it, but I need to review JS syntax. The lesson Selecting from Many Options with Switch Statements seems like it could benefit from an update. I think that using lowercase and uppercase letters in the challenge instructions should be replaced with a different example because of possible confusion between “case” as referring to switch statement cases and “case” as referring to lowercase and uppercase letters.

I’m looking over the documentation to see how I can get involved and propose this change, but I wanted to put it out here on the forum.

I mean the example code is doing just that - taking an input called lowercaseLetter and outputting the corresponding uppercase letter:

switch (lowercaseLetter) {
  case "a":
  case "b":

It seems like a slight change in the example might prevent confusion.

I can see how the case clause combined with code that does letter casing logic and has a lowercaseLetter identifier might be a potential pitfall with the example. It does have a bit of unnecessary ambiguity.

Not suggesting it absolutely has to be changed, but I wouldn’t be opposed to it either. Maybe open an issue for it.

Less ambiguous example code:

switch (heroName) {
  case "Spider-Man":
    console.log("Peter Parker");
  case "Batman":
    console.log("Bruce Wayne");

I opened an issue

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.