iii)Float to Integer
To convert a value from float to integer we have to use the function or method parseInt().
Example
<html>
  <head>
  </head>
  <body>
  <script type="text/javascript">
  var a = 5.5;
  var b = 1;
  var c = parseInt(a)+b;
  document.write("parseInt(a)+b = "+c);
  </script>
</body>
  </html>
Output
Click the buttons below and see what outputs give.
No comments:
Post a Comment