+ 1

How can i make this functional

JavaScript with switch case https://code.sololearn.com/WZTObAba3hw2/?ref=app

3rd Nov 2021, 11:30 AM
𝓐𝓷𝓼𝓱𝓲𝓴𝓪 (Anshika)
𝓐𝓷𝓼𝓱𝓲𝓴𝓪 (Anshika) - avatar
2 Respostas
+ 2
var val= prompt("enter Yes/No"); //taking user input by prompt switch(val) { case 'Yes': console.log("ok then") break; case 'No': console.log("fine") break; default : console.log("no") }
3rd Nov 2021, 11:38 AM
Jayakrishna 🇮🇳
+ 1
The condition for the cases must be of a type that val can be compared to, e.g. a string or a number. But currently Yes and No are not defined
3rd Nov 2021, 11:37 AM
Lisa
Lisa - avatar