The basic syntax of the function is:
parseInt() function takes the following parameters as input:
Radix is an optional parameter. In case it is not mentioned, the following assumptions are made:
If the function parses the string successfully, the integer value is returned. In case the string cannot be converted to an integer value,
NaN is returned.
Note: In case the string starts with a numeric character but is followed by an alpha-numeric character, the string is parsed until the occurrence of the first alphanumeric character
Let’s look at some examples to understand further how to use the
View all Courses