The global Number function converts a value to a number primitive when called without new. With new, it returns a Number object wrapper. It is Baseline Widely available.
Pass the required arguments shown below. Prefer Number(value) for coercion; avoid new Number() unless you need an object wrapper.
Syntax
Create or coerce a number. Start with this line.
JavaScript
Number(value) / new Number(value)
Call
What it does
Number(value) / new Number(value)
Primary signature.
Built into JavaScript. Call Number(...) (prefer without new) — no import required.
No auto-unbox for ===. A Number object is not strictly equal to 10.
Primitives compare cleanly.Number(10) === 10 is true.
Escape hatch..valueOf() or Number(wrapped) extracts the primitive.
Best fix. Do not create Number objects — stay with literals and Number(x).
Compatibility
Browser & Runtime Support
The Number constructor is Baseline Widely available and supported in every modern browser and Node.js.
✓ Baseline · Widely available
Number() constructor
Safe for production everywhere. Prefer Number(value) for conversion; avoid new Number().
100%Universal support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Number()Excellent
Bottom line: Use Number(value) to coerce to a primitive. Avoid new Number(). Convert BigInts explicitly and watch precision past MAX_SAFE_INTEGER.
Frequently Asked Questions
Number is a built-in global. Call Number(value) without new to coerce value to a number primitive. Call new Number(value) to wrap that number in a Number object — rarely needed in everyday code.
Number("123") returns the primitive 123 (typeof "number"). new Number("123") returns a Number object (typeof "object"). Prefer the function form; MDN warns you should rarely use Number as a constructor.
Strict equality compares type and value. A Number object and a number primitive are different types even when their numeric value matches. Prefer Number(value) or literals so you stay with primitives.
Yes. Number(1n) returns 1. Unary plus and mixed BigInt arithmetic throw, so Number() is the explicit conversion path. Large BigInts may lose precision when converted to Number.
Number() with no argument returns 0. Number(undefined) returns NaN. Number(null) returns 0. Number("") returns 0. Invalid numeric strings return NaN.
Number has been part of JavaScript since early editions. It is Baseline Widely available in every modern browser and Node.js.