Exercise 4.4

This commit is contained in:
Karan
2021-11-24 19:28:37 +05:30
committed by GitHub
parent 2e15a2b493
commit 83d1446612
+21
View File
@@ -0,0 +1,21 @@
const randomNumber = Math.floor(Math.random() * 6);
let answer = "Something went wrong";
let question = prompt("Ask me anything");
switch (randomNumber) {
case 0:
answer = "It will work out";
break;
case 1:
answer = "Maybe, maybe not";
break;
case 2:
answer = "Probably not";
break;
case 3:
answer = "Highly likely";
break;
default:
answer = "I don't know about that";
}
let output = "You asked me " + question + ". I think that " + answer;
console.log(output);