LogoHeader

 

Programming JavaScript

There are many simple things you will find in every JavaScript program. They are the for/ while loops, the if/ else if/ else statements and the var statement. Using each one is able to make a very complex program.

Java code

The for/ while loops are the only way to “Loop” back and do something over and over. The only difference between them are that the for only loops so many times, the while loop goes on until told otherwise.

    An Example of each:

while(x = true){};

for(a,100,1){};


The if/ else if/ else statements are the most basic ways to have a sort of divider which will tell if something is true or not. The elseif and else statements only work after an initial if statement.


Example:

if(x = false){};

if(x = false){

}else if(x = true){

}else{};


Now, in my opinion, the most important part ever the var statement. The var declares variables and arrays. These are needed in order to do almost anything. The x that we used in the previous examples was a variable.


Example:

var x = true;

var a = [“Hello”,1,true];

As you have probably seen above after every command you put a ;. This is needed so that the computer knows where the command starts and stops.


Top

Description:

JavaScript is one of the best programing language you can easily find.