|
|
if(Boolean expression) { statement; statement; etc. } |
if(hrs>40) { reghrs = 40; othrs = hrs - 40; } |
if((temp<-100)||(temp>220)) { document.write("Temperature out of range"); } |
if((a>0)&&(b>0))) { document.write("a & b are both above zero"); } |
if(Boolean expression) { statement; } else { statement; } |
if(hrs>40) { regpay = pay*40; otpay = pay*(hrs-40); } else { regpay = hrs*40; otpay = 0; } |
while(isNaN(hrs)) { alert("Enter a numeric value"); hrs=prompt("Enter number of hours worked",""); } |
Shortcut | Effect | |
x++ | x = x+1 | |
x- | x = x-1 | |
x+ = y | x = x+y | |
x- = y | x = x-y | |
x* = y | x = x*y | |
x/ = y | x = x/y |