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.


You can try to run the following code to learn how to work with parseFloat() method in JavaScript.

<!DOCTYPE html>
         var val1 = parseInt("20.50");
         var val2 = parseInt("30 minutes");
         var val3 = parseInt("20",16);