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

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

**Transcript :**

Hi, and welcome back.

So, what I said in the last video is that there are certain cases where parseInt() is not able to convert the string into a number.

And if it tries to convert something into a number that it cannot convert into a number, it will return ‘not a number’.

So for example, let’s say you have a string ‘abc’.

And you want to convert this into a decimal number.

Of course there is no digit within the decimal numbers that has any of this.

So there will be no way for this to get converted to a decimal number.

So this will return ‘not a number’.

And then, you see this parseInt().

We are converting this into an octal number.

And we know that an octal number only has digits from ‘1’, rather from ‘0 to 7’.

It doesn’t have ‘8’ and it doesn’t have ‘9’.

So this will not be convertible to an octal number and that will return ‘not a number’.

And then, this one, trying to convert this one into a binary number.

We know a binary number only has ‘0’ and ‘1’.

Only these two.

And we are trying convert these ones into a binary number.

These are not available in the binary digits.

So this ones will give you ‘not a number’.

So let’s go to the browser and just see some of this in examples.

So if I come back to Scratchpad, let me just delete everything there.

Then, let’s start with this one and convert this one into ‘2’.

We know that these ones are not part of ‘0’ or ‘1’.

We know that ‘0’ and ‘1’ are the only acceptable numbers that can be converted into binary.

So if you try to convert this one and display, it returns ‘not a number’.

And then, let’s say we take this one into ‘183’, and we try to convert this into an octal number.

So an octal number only has from ‘0’ up to ‘7’.

‘8’ is not there.

So that means it’ll convert up to the point that it can convert something to an octal number.

In this case, ‘1’.

So if we display this one, it will only return ‘1’ because it converted ‘1’ into an octal number and then was not able to convert the rest.

So if I remove this one and now we only have ‘83’.

It’ll not be able to convert ‘8’ and it will stop there and it’ll just give us back ‘not a number’.

So if I display that, it gives us ‘not a number’.

If I also come here, let’s just use something else like ‘abcde’ and then we try to convert this into an octal number.

And then, we display.

It will return ‘not a number’.

There are certain cases where you, you may not have that.

It may be undefined or missing.

So in this case, if the number which is here is like this, and we try to display this number, it would give us back ‘not a number’.

And if we put ‘123’ and then we try to display this, let me use, let me give you a good example here of ‘14’, right.

If I start this number ‘14’ and I don’t have a radix and I display this.

So the parseInt(), if I convert ‘14’ into a number and display it, remove all of that, if I display this, it’ll give us ‘14’.

So if I convert this, it’ll give us ‘14’.

So let’s come back here and see certain rules for how this might behave if we don’t have a radix.

So I don’t want this video to be long and therefore in the next video, let’s come back here and see what will happen if the radix is ‘0’ or the radix is ‘undefined’ or the radix is missing.

So I’ll see you in the next video.

Click the button below to watch this full course: