How to use number range in switch/case by JavaScript
Editor to share with you how JavaScript uses digital ranges in switch/case, I believe most people don't know much about it, so share this article for your reference. I hope you can learn a lot after reading this article. Let's learn about it together.
Using numeric ranges in switch/case
In fact, the case condition in switch/case can also be written as follows:
Function getCategory (age) {var category = ""; switch (true) {case isNaN (age): category = "not an age"; break; case (age > = 50): category = "Old"; break; case (age)