Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the role of parseInt() method in JavaScript?
Use the parseInt() method in JavaScript to return an integer after parsing a string. You can also set the numeral system as a second parameter.
Example
You can try to run the following code to learn how to work with parseFloat() method in JavaScript.
<!DOCTYPE html>
<html>
<body>
<script>
var val1 = parseInt("20.50");
var val2 = parseInt("30 minutes");
var val3 = parseInt("20",16);
document.write(val1);
document.write("<br>"+val2);
document.write("<br>"+val3);
</script>
</body>
</html>Advertisements