<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript Switch Case Check Range</title>
</head>
<body>
<pre> <!-- Use pre element for work document.writeln() method -->
<script>
var bdate = 20;
switch (true) {
case bdate >= 1 && bdate <= 10: // Use Logical AND
document.writeln("bdate between 1 to 10 date.");
break;
case bdate >= 11 && bdate <= 20: // Use Logical AND
document.writeln("bdate between 11 to 20 date.");
break;
case bdate >= 21 || bdate <= 30: // Use Logical OR
document.writeln("bdate between 21 to 30 date.");
break;
default:
document.writeln("No any case found.");
}
</script>
</pre>
</body>
</html>