# 28 parseInt in Javascript

Last updated on July 13th, 2020 at 11:28 am.

This video is taken from the full course that will teach you HTML, CSS, Programming concepts and Javascript .

Transcript :

Hey, and welcome back.

And welcome to the ‘parseInt()’ video.

So in the last video, we started looking at how you can convert a string to a number.

So if you have something like this being held in the memory, this is a string.

But you want to convert it so that you can use it as a number.

So, in this video let’s see how you can do the same using the ‘parseInt()’ function in JavaScript.

Now, the ‘parseInt()’ will parse a string and it will return an integer based on the radix you define.

A radix is the base of the number.

Of the radices that we have or rather the radices that we mostly use is ‘base 10’.

‘Base 10’ which is the decimal numeral system.

So you don’t really have to worry much about this, because this is something you need to know and that’s enough.

So the decimal number that we have are what we use.

So the ‘radix’ basically means the unique amount of different digits that can be used to represent numbers in that system.

So our decimal numeral system that we mostly use has 1, 2, 3, 4, 5, 6, 7, 8, 9 and then 0.

So if you count this, they amount to 10.

And that is why we have ‘Base 10’, our decimal system.

You may also have heard about the binary.

And the ‘binary’ has only two possible numbers – zero and one.

You may also have heard of the octal system.

The ‘octal’ has eight possible numbers.

So it will start from, let’s put zero here.

So it can start from zero, all the way up to seven, that is the octal.

You may also have heard of the ‘hexadecimal’ system.

‘Hexadecimal’ which has 16 possible digits that can be used to represent a number in that numerical system.

So in the radix, in the hexadecimal system, ‘hex’, let’s just call it ‘hex’, you can have zero, up to nine.

And then from nine, you will use ‘A’ up to, ‘A’ up to ‘F’, so that they can be 16.

So let’s just say ‘A’, what do we have the A, B, C, D, E, F.

So you’ll have 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and then ‘A’ will be ‘10’, that will be 11, 12, 13, 14, 15.

Then if you add zero, there will be 16 possible digits which gives you the hexadecimal.

So the radix is the unique digits that can be used in the number system to represent any number in the system.

In our decimal system, we know that if you want to represent a billion, you can only use numbers within ‘0 to 9’.

So, if you want to convert a number, you want to convert a string to a number using the ‘parseInt()’, you’ll put the string in there and then you put the radix.

And now the radix is a number from ‘2’, it can be a number from ‘2’ to ‘36‘.

And we’ve explained what a Radix is.

In most cases, the radix we use is 10.

That’s our normal number numeral system.

So for the other radices, if a number goes beyond 10, all the other part of the number will be listed using the alphabet.

So from ‘A’ to ever.

Like we’ve seen for hexadecimal, it goes all the way up to ‘F’.

If you want to represent a number with a radix of 11, the next number in the series will be ‘A‘.

So 11 will be ‘A’.

If you want to represent a number with 12, the next number, so as long as it reaches nine, you start to, you start to use the alphabet numbers.

So, so here are some examples ‘F23’.

This is, we are converting this into a hex number, hexadecimal number that has a radix of 16.

So I’ll see you in the next video.

Click the button below to watch this full course:

### Recommended VPS Providers

Find out the VPS providers I recommend.

Close me!