validateNumber
Checks if the given value is a number.
- Use
parseFloat()
to try to convertn
to a number. - Use
!Number.isNaN()
to check ifnum
is a number. - Use
Number.isFinite()
to check ifnum
is finite. - Use
Number()
and the loose equality operator (==
) to check if the coercion holds.