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
parseFloat() function in JavaScript
The parseFloat() function accepts two parameters one is a string representing a number and another is a number representing the radix and returns an integer of the given radix.
Syntax
Its Syntax is as follows
num.parseFloat('4524', 8);
Example
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result1 = parseFloat(Math.PI);
document.write("Result: "+result1);
document.write('<br>');
var result2 = parseFloat("245.12@welcome");
document.write("Result: "+result2);
document.write('<br>');
var result3 = parseFloat("11111100.010");
document.write("Result: "+result3);
</script>
</body>
</html>
Output
Result: 3.141592653589793 Result: 245.12 Result: 11111100.01
Advertisements