      

 if  :=-

 :-

if(test expression)statement to execulte when true;

 /

var msg,num

num=7;

if(num%2!=0){

msg="This is an odd number.";

alert(msg);

}

       (%)        num

   2   


***         

num(%2==1) 

     if


var username=null;

if(username==null){

username=prompt("please Enter Your Name","");

if(username!="")alert("welcom"+username);

}


                  

   



  if-else :=-

   

if(test expression)do this;else do this;

         else

var num=2,bool=false;

if(num==1&&bool==1)alert("TEST1 bool:"+bool);

else

if(num==2&&bool==1)alert("TEST2 bool:"+bool);

else

if(num==2&&bool==0)alert("TEST3 bool:"+bool);

else

if(num==3&&bool==0)alert("TEST4 bool:"+bool);



  switch :=-

           

   case   

   default    

       break

var num=2;

switch(num){

case 1:alert("This is case 1 code");break;

case 2:alert("This is case 2 code");break;

case 3:alert("This is case 3 code");break;

default:alert("This is default code");

}

  for :=-



for(initializer,test,increment)statement;

 initializer            

           "i"

         

   

var a=0,b=0;

for(var i=0; i<5; i++){

a+=10;b+=5;

}

alert("FOR LOOP\n\n A is"+a+"...B is"+b);

  For-In :=-

var i=0;a="";

or(property in window){

a+=property+"...";

}

alert(a);

  while :=-

         

 /*/*/*/ 

        

var i=0,num=50;

while(i<15){

num--;

i++;

}

alert("LOOP stopped at" +i+ "\nnum is now" +num);

  Do-While  :=-

   do    

      

var i=0,num=50;

do{

num--;

i++;

}while(i<1);

alert("LOOP stopped at" +i+ "\nnum is now" +num);

  Break :=-

var i=0;

while(i<6){

if(i==3) break;

i++;

}

alert("BREAK\n\nLoop stopped at" +i);

  CONTINUE :=-

    

var i=0,str="";

while(i<5){

i++;

if(i==3)continue;

str +=i+"";

}

alert("CONTINUE\n\nLoop stopped:" +i+ "\n\nSeries:"+str);


  With :=-

             

 :=-

     document     forms   

   

document.forms.order.user.value="7azm"

document.forms.order.city.value="ksa"


 :=-

with(document.forms.order){

user.value= "7azm";

city.value= "ksa";

}


*****************************************************

      

     

 

 
