In JavaScript, a Number is a numeric value: integers and floating-point numbers such as 42, 3.14, and -7. There is one built-in numeric type for everyday math (IEEE-754 double precision)—not separate int and float types like some other languages.
You write numbers as literals, convert strings with Number() or parseInt(), and use operators like +, -, *, and /. Special values include NaN (invalid math) and Infinity (overflow).
Number(string) parses the whole string as a number.
Empty string becomes 0.
Invalid text becomes NaN.
Example 3 — Arithmetic operators
Everyday math with +, -, *, and /.
JavaScript
const x = 10;
const y = 3;
console.log("Sum:", x + y);
console.log("Diff:", x - y);
console.log("Product:", x * y);
console.log("Quotient:", x / y);
console.log("Remainder:", x % y);
Number is the built-in type for numeric values—integers and floating-point numbers such as 42, 3.14, and -7. Under the hood it uses IEEE-754 double precision (one Number type for both).
Use a literal: const n = 42; or const x = 3.14;. You can also convert with Number("42"), parseInt("42", 10), or unary plus: +"42".
NaN means Not-A-Number—the result of invalid math like 0 / 0 or Number("hello"). NaN !== NaN. Detect it with Number.isNaN(value).
Call Number(value) to get a number primitive. Avoid new Number(value)—it creates a Number object and typeof becomes "object", which confuses === checks.
Practice the examples here, then open the Number Methods index for toFixed(), toString(), isInteger(), and the Number Properties index for MAX_SAFE_INTEGER, EPSILON, and Infinity.