How to use The parselnt in JavaScript:- Geniusofstudent

  • The parseInt() function parses a string and returns an integer.
  • The radix parameter is used to specify which numeral system to be used, for example, a radix of 16 (hexadecimal) indicates that the number in the string should be parsed from a hexadecimal number to a decimal number.
  • Only the first number in the string is returned.
  • If the first character cannot be converted to a number, parseInt() returns NaN.





Code:-

  1. <!DOCTYPE html> 
  2. <html> 
  3.  
  4. <head> 
  5.  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  6. </head> 
  7.  
  8. <body> 
  9.  <h1>parseInt()</h1> 
  10.  <h2>77.36</h2> 
  11.  
  12.  <input type="button" onclick="con_int();" value="parseInt(77.3)"> 
  13.  
  14.  <script> 
  15.   function con_int() 
  16.   { 
  17.    var n1 = "77.36"; 
  18.    alert("Integer : " + parseInt(n1)); 
  19.   } 
  20.  </script> 
  21.  
  22. </body> 
  23.  
  24. </html>
How to use The parselnt in JavaScript:- Geniusofstudent How to use The parselnt in JavaScript:- Geniusofstudent Reviewed by Network security on July 02, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.