Standard built-ins
Number.parseInt()
The Number static property refers to the same built-in function as the corresponding global parser. Reads an integer prefix in a selected radix; ignores trailing invalid digits and yields NaN if no valid prefix exists.
Formal Syntax & Structure
javascript syntaxjavascript
Number.parseInt(value, radix?)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| value | any | Converted to text before parsing. |
| radix | number | Base 2 through 36; omitted or zero uses prefix-based default. |
Return Value
number
Parsed Number, possibly NaN.
Working Example
Example Snippetjavascript
console.log(Number.parseInt("12px",10));