JavaScript DHTML/Data Type/parse

Материал из Web эксперт
Перейти к: навигация, поиск

parseFloat("1.23e-2")

   <source lang="html4strict">
 

<html> <head> <title>Convert String to Number</title> </head> <body>

<script type="text/javascript"> var sNum = "1.23e-2"; document.writeln(parseFloat(sNum)); </script>

</body> </html>


 </source>
   
  


parseFloat("1.45inch")

   <source lang="html4strict">
 

<html> <head> <title>Convert String to Number</title> </head> <body>

<script type="text/javascript"> var fValue = parseFloat("1.45inch"); document.writeln("<p>" + fValue + "

");

</script> </p> </body> </html>


 </source>
   
  


parseInt("33.00")

   <source lang="html4strict">
 

<html> <head> <title>Convert String to Number</title> </head> <body>

<script type="text/javascript"> var iValue = parseInt("33.00"); document.writeln("<p>" + iValue + "

");

</script> </p> </body> </html>


 </source>