'Any particular reason why this switch-case statement in js is returning undefined?
Here is my code. I have cross checked with online docs and couldn't find any reason for this to not work.
let marks = 90;
switch (marks) {
case 1:
if (marks <= 100 && marks >= 80) {
console.log("Very Good");
}
break;
case 2:
if (marks >= 60 && marks <= 79) {
console.log("Good");
}
break;
case 3:
if (marks >= 30 && marks <= 59) {
console.log("Can do better");
}
break;
case 4:
if (marks < 30) {
console.log("Fail");
}
break;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
