
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
parseInt Function in JavaScript
The parseInt() 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.parseInt('4524', 8);
Example
<html> <head> <title>JavaScript Example</title> </head> <body> <script type="text/javascript"> var result = parseInt('4524', 8); document.write("Result: " + result); </script> </body> </html>
Output
Result: 2388
Example
<html> <head> <title>JavaScript Example</title> </head> <body> <script type="text/javascript"> var result1 = parseInt('4524', 8); document.write("Result: " + result1); document.write("<br>"); var result2 = parseInt('4524', 10); document.write("Result: " + result2); document.write("<br>"); var result3 = parseInt('4524', 16); document.write("Result: " + result3); </script> </body> </html>
Output
Result: 2388 Result: 4524 Result: 17700
Advertisements