JavaScript Reference/Javascript Methods/parseInt

Материал из Web эксперт
Версия от 11:22, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"parseInt()" Example

   <source lang="javascript">
   

<html> <body> <button onclick="alert(parseInt("12.34"));">Number</button> <button onclick="alert(parseInt("Hello"));">NaN</button> </body> </html>


     </source>
   
  


"parseInt()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Converts the string to an integer. Returns an integer if value supplied is numeric or NaN if value supplied is not numeric.

Syntax:

parseInt(param1) Parameters:

   param1   Required; the string to be evaluated.
   
     
     </source>