Standard built-ins
Number() conversion
Called without new, Number converts an argument to a Number primitive; invalid numeric text yields NaN. Empty text and null convert to zero; undefined converts to NaN. BigInt can be explicitly converted, potentially losing precision. An omitted argument returns zero.
Formal Syntax & Structure
javascript syntaxjavascript
Number(value)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | any | Value to convert; omitted means zero. |
Return Value
number
Numeric conversion result, possibly NaN.
Working Example
Example Snippetjavascript
console.log(Number("42"));console.log(Number(""));