+ 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 Answers
+ 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