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 do not see making such a change. I see nothing in how the challenge is worded that would make a user think the the keyword case has anything to do with making things lowercase or uppercase.
It is not changing the value of lowercaseLetter. It is just using console.log to display a letter. Plus there is nothing in the challenge description that suggests the ability of it to change the case of a string like the String.prototype.toLowerCase() or String.prototype.toUpperCase() methods do.
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");
break;
case "Batman":
console.log("Bruce Wayne");
break;
}