The JavaScript number parseInt() method is used to convert a string into an Integer number.
Syntax:
Number.parseInt(string, radix)
Number.parseInt(string, radix)
Number.parseInt(string, radix)
Parameters
string: It represents the string that has to be converted into an integer number. It is a required parameter.
radix: It represents the number format. It is an optional parameter.
Returns
Integer number.
Example:
<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Number.parseInt("50.5FIVE"));
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Number.parseInt("50.5FIVE"));
</script>
</body>
</html>
<!DOCTYPE html> <html> <body> <script> document.writeln(Number.parseInt("50.5FIVE")); </script> </body> </html>