JS Number Reference
Prefer Number.isFinite and Number.isNaN when checking numeric inputs. They do not silently coerce strings.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
console.log(Number.isFinite(8));
console.log(Number.isFinite("8"));
console.log(Number.isNaN(NaN));
What happens
The results are true, false, and true.