17.2 practice | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

17.2 practice

function main() { var themNumber= 2 parseInt(readLine(), 10) /* 1 - Light 2 - Dark 3 - Nocturne 4 - Terminal 5 - Indigo */ // Your code here switch ("themeNumber2"){ 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"); } }

18th Sep 2022, 1:16 PM
Emmanuel Pena
4 Answers
+ 2
var themNumber= 2 // this assigns 2 parseInt(readLine(), 10) // this will accept input but ingore next.. It must be like : var themNumber = parseInt(readLine(), 10); Next is : switch ("themeNumber2"){ // passing string.. Incorrect. Correct way is switch( themeNumber ){ // passing variable value... Hope it helps...
18th Sep 2022, 1:28 PM
Jayakrishna 🇮🇳
+ 1
I dont get it can you explain
18th Sep 2022, 1:41 PM
Emmanuel Pena
+ 1
I got it !!! Thank you
18th Sep 2022, 3:19 PM
Emmanuel Pena
0
I did give explanation only... What you not understanding ? 2 mistakes you have and corrections you need is what I posted..
18th Sep 2022, 2:07 PM
Jayakrishna 🇮🇳