34 Integer Literals – Javascript

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

34 Integer Literals - Javascript Tutorial 2018

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

Transcript :

Hi, and welcome back.

We know that integers can be expressed as a decimal, a hexadecimal or octal or binary.

A decimal number, this is one that has 0-9.

So you remember in the last, one of the last videos, we said something about radices.

So if you remember a radix, that is the possible numbers that are possible in any number within that number system, within that numeral system.

For example, if you want to write 9 billion, you can only define 9 billion from 0-9.

So it will maybe 9 billion and a bunch of zeroes there.

If you want to write 1 million and something, you can only use numbers from 0-9 that is in the base 10 number system.

Then hexadecimals, these are numbers that come from 0-9 and then from 9, it goes from A-F.

And then in the octal system, the numbers can only use numbers from 0-7 and in the binary, we only have two that is 0 and 1.

These are the only numbers you can use to express any number within this numeral system.

So that’s what these are.

And these are the different kinds of integer numbers that you can use for defining any kind of a literal in your program.

So in most cases you’;; find that you use decimals.

Yeah actually, all over the world, most places, the number system that is used is the decimal whereby you can define any number from 0-9.

If you want to write 19, it would be 1 and 9.

If you want to write 22, it would be 2 and 2.

So if I come back here to the browser and I have this variable TAX and I’ve given it an initial value of 15.

So in this case, the literal value is the integer 15.

So if I come down here and let me just say I use the value of VAT*2.

Then display the result, ok.

Oh my God.

I can’t even see.


Let’s say TAX.

It’s not VAT, it’s TAX.

So TAX*2 and then I display.

So that’s 30.

So, if I decide that I want to use this number as a, let’s say we use it as a hexadecimal number.

And as a hexadecimal number, we can only define numbers from A-F, 0-9 and A-F.

So the equivalent of, so the equivalent of 15 in the hexadecimal number system is F.

15 is the same as F.

So if I come back here, how do we tell the system, how do we let the system know that this number is a hexadecimal number.

The way that I tell the system that is by using ‘0’ and a small ’x’ or a capital ‘X’.

And as soon as I do this, the system is going to know that this number is not like any other number.

This is a hexadecimal number.

That’s how it will be translated in the system.

So if I do the same, same calculation of TAX*2, we should be able to get the same result.

This is F.

So if I do the same result once again and display, yeah, it should give us the same result as we had found when it was 15.

So let’s continue in the next video.

And in the next video, let’s go deeper into more about this.

So in this video, I just wanted to do an introduction of integer literals whereby we know, you can use your number as a base 10 number or you can even use numbers as hexadecimal or you can even use numbers as octal or you can use them as binary.

As long as you let the system know, they will be translated and used accordingly.

So let me see you in the next video where we’ll continue from here.

Click the button below to watch this full course:

Comment Here

Need WordPress help? Linux Server help? Talk to us.

  • We are your own WordPress customer service.
  • We set up Linux servers and install or migrate WordPress. Learn more here.
  • We support WooCommerce too.
  • Check out our WordPress customer support plans here or contact us below .

If you have any questions regarding WordPress support, Linux server support or any of our services, feel free to reach out or read more on our services page.

Join this free course:

How to host multiple WordPress
websites on a VPS

Close me!