Skip to main content

java script lesson (3) variables

variables

variables

hi everybody and welcome to the third part for javascript tutorial
in this tutorial, we going to learn variables it is very easy lesson let’s get started

Get the CODE



how many colors did you see in the picture?
it is four right ?
hmm ok let's give some variables for our colors
yellow green red blue
to create a variable we just need var so go to u text editor and write var

Now let’s give a name for our variable
i am gonna to call it yellow and give it number 1 u can give any name and number u want

now continue and create more var with the same colors in the picture and give it any number you want

Now i want to collect all these variables together
to make this we going to create another variable and you can call it any name u want i will call it father

after created a father variable now let’s collect all variables and see the result

Now your variables are ready just write the command to get the result

u can also use document.write() all is work

we have 4 color :)
as u see this is the final result
we can also use negative way just add - instead of + and let’s see the result


this is simply how to variables works :)