1, post increment/decrement operator ++,--
such as: Var i=0;
var a=i++;
Console.log (a);
2 . Comparison operator (<, >=, <=, = =,!=,===,!==)
Alert (> 5); Outputs True
var i = 100;
var n = 100;
alert (i = = n); Outputs true;
Alert (i! = n); Outputs false;
alert (i = = N)//data type, value equal
3, logical operators (&&, | |,!)
&&: Logic and
|| : Logical OR
! : Logical Non-
var i = 8;
Alert (i<5 && i<10); Outputs false
Alert (i > | | i < 10); Outputs True
Alert (! ( > 5)); Outputs false
Second, the program flow control
1. Conditional Statement if
Grammar:
if (condition) Statements1 else statement2
Cases:
if (> 5) {
Alert ("Hello World");
}
var i = 90;
if (i > 100) {
Alert (i + "greater than 100");
}else if (i > 80) {
Alert (i + "greater than 80");
}else{
Alert (i + "less than 100");
}
2.switch Statement
Grammar:
switch (expression) {
Case Value:
Statement
Break
Case Value:
Statement
Break
Default
Statement
}
Cases:
var i = 25;
switch (i) {
Case 25:
Alert (i + "equals 25");
Break
Case 100:
alert (100);
Break
Default
Alert (' other ');
}
Third day JavaScript operator (cont.)