Home > Article > Web Front-end > Comparison of two methods using JS to determine whether a number is a combination of numbers and decimal points (isNaN and one-by-one judgment)_javascript skills
Here are some examples: If you have a better method, I hope you will come up with a better method.
1: isNaN method:
isNaN() means non-number. If a number is passed in, it will return false. If it is not a number, it will return true.
[If it is empty, it will also return true, as will a dot. Return true, click a number combination to return false, indicating that it is a number]