parseInt
IMPORTANT!
Starting with v24.3, this is deprecated.
Starting with v24.3, this is deprecated.
Converts a string to an integer in the specified base.
Syntax
function parseInt(number: string, baseValue: number): number
| Parameter | Description |
|---|---|
number
|
String containing the number in text format. |
baseValue
|
Value between 2 and 36 representing the base of the number. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal. |
Return Value
Returns the numeric integer data type representation of the string.
Examples
In this example, we save the 1101010110 text string into a base 2 numeric variable called operand.
var operand = parseInt('1101010110', 2);