0

The switch statement (Dark theme) question

Can someone kindly tell me what’s wrong with my code var themeNumber = 2; switch(themeNumber){ case 1: console.log("Light") break; case 2: console.log("Dark") break; case 3: console.log("Nocturne") break; case 4: console.log("Terminal") break; case 5: console.log("Indigo") }

22nd Dec 2021, 3:51 PM
Rukundo Elvis
Rukundo Elvis - avatar
5 RĂ©ponses
+ 6
Rukundo Elvis , if the code you have shown here is for solving a code coach exercise and if it is your complete code there are 2 other issues: â–Șmain function is missing â–Șinput is missing, you just used a fixed value both of these thing are given as a basic code when you are starting to solve the task.
22nd Dec 2021, 6:19 PM
Lothar
Lothar - avatar
+ 3
I don't see any error? However, I would recommend you to insert the ; at the line endings and add the "break" in case 5. Maybe you would also like to make use of the default case?
22nd Dec 2021, 4:05 PM
Lisa
Lisa - avatar
+ 2
Can you please link your complete code the way it is now? I just did the task and it worked for me...
22nd Dec 2021, 7:14 PM
Lisa
Lisa - avatar
0
Lothar even when all that is included it still says that test cases 1, 3, 4 are wrong.
22nd Dec 2021, 7:09 PM
Rukundo Elvis
Rukundo Elvis - avatar
0
Lisa i’ve done all that and it doesnt seem to work
22nd Dec 2021, 7:09 PM
Rukundo Elvis
Rukundo Elvis - avatar