Javascript Reference
Categories: Global

javascript Global parseInt( )

@March 15, 2008, 1:22 a.m.
parseInt( )Firefox/Netscape/NN 2 IE 3 ECMA 1  

parseInt("string "[, radix])

  

Returns an integer value (as a number data type in base-8 or base-10) of the numerals in the string passed as a parameter. The string value must at least begin with a numeral, or the result is NaN. If the string starts with numbers but changes to letters along the way or includes white space, only the leading numbers up to the first nonnumeral or whitespace are converted to the integer. Therefore, you can use the expression:

parseInt(navigator.appVersion)
 

to extract only the whole number of the version that leads the otherwise long string that is returned from that property.

 

The optional radix parameter lets you specify the base of the number being passed to the function. A number string that begins with zero is normally treated as an octal number, which gives you the wrong answer. It is a good idea to use the radix value of 10 on all parseInt( ) functions if all of your dealings are in base-10 numbers.

 
Parameters
 
  • Any string that begins with one or more numerals.
  • An integer of the number base of the number passed as the string parameter (e.g., 2, 8, 10, 16).
 
Returned Value

Integer.

lipitor 10mg tablet <a href="https://lipiws.top/">lipitor 10mg for sale</a> buy lipitor 80mg online cheap
Fvwxlu - 10 months
order lipitor 80mg pill <a href="https://lipiws.top/">order atorvastatin 20mg for sale</a> buy lipitor online
Xeotxx - 10 months

Powered by Linode.