JavaScript has a single Number type for integers and decimals.
toFixed(2): format with 2 decimals (returns a string).
Number("42"), parseInt("42px"), parseFloat("3.14"): convert strings to numbers.
NaN means "Not a Number"; check with Number.isNaN().
Infinity is the result of dividing by zero.
Number.isInteger(), Number.MAX_SAFE_INTEGER
Decimal maths can be imprecise: 0.1 + 0.2 is 0.30000000000000004. Round results when displaying money.
💡 Key Takeaways: JavaScript Numbers
Mastering JavaScript Numbers helps you write clean and reliable JavaScript code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.