parseInt

Modified on Mon, 31 Jul 2023

Description

Convert string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used unless value is a hexadecimal, in which case a radix of 16 is used

Syntax

parseInt(text, radix)

Parameters

Input ParameterTypeDescription
textstringstring The string to convert.
radix (optional)numberThe radix to interpret `value` by.

Return value

Type
number

Sample

ExampleResultDescription
parseInt('08')8Convert string to integer

To view all the String functions, click here.