0

JavaScript | Switch Statement | Can't Find the Error or Bug Please someone help me to find that Bug or Error

The user can choose the color theme for the browser: 1. Light 2. Dark 3. Nocturne 4. Terminal 5. Indigo You are given a program that takes  the number as input. Complete the program so that it will output to the console the theme according to input number. Sample Input 2 Sample Output Dark Solution: I write function main() {     var themeNumber = parseInt(readLine(), 10)    1 - Light     2 - Dark     3 - Nocturne     4 - Terminal     5 - Indigo     */     // Your code here     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")         break         case default:         console.log(1)         break     } }

29th Sep 2022, 7:02 AM
iSharafatHussain
iSharafatHussain - avatar
1 Réponse
+ 2
If you use readline you need install node.js because isn't include in js but you can to use prompt to get input user
29th Sep 2022, 9:01 AM
ALI Moussa Kadjalla
ALI Moussa Kadjalla - avatar