All about javascript parseInt

Javascript, the most popular programming language and one of the core technologies of the web. It is used client-side for web page behavior.

In this article, we will have a look at Javascript parseInt function. We use parseInt to convert a string into an integer.

Use cases of parseInt function

To convert string to decimal we use parseInt with two parameters. The first parameter is the string that is being converted. The second parameter is optional that is declared to mention what type of number that string contains, i.e. decimal, binary, hexadecimal, or octal.

For example, we gonna convert a string (containing decimal number) to an integer.

Here second parameter 10 is to return the result from decimal or base 10.

Now we gonna convert a string (containing an octal number) to an integer.

Like so, we gonna a string (hexadecimal number) to an integer.

Like so, we gonna a string (binary number) to an integer.

So far today. I’ll write another day.