| Operator | Definition | Simple Example |
| + | Add | sum=36.50+2.33; |
| - | Subtract | differ=101.0-98.6; |
| * | Multiply | prod=5*9; |
| / | Divide | ratio=3/5; |
| % | Modulo | Remainder in a division: xs=22%5; (modulo=2) |
| Date="Marc"+"h 15"+", 2000"; leads to Date="March 15, 2000" |
| Wrong answer: y=a/b-x; Right answer: y=a/(b-x); |
| if (condition) {Statement(s) 1;} else {Statement(s) 2;} |
| JS Conditionals | |||
| Name | Symbol | Name | Symbol |
| Equals | == | Not equal to | = |
| Greater than | > | Greater than or equal to | >= |
| Less than | < | Less than or equal to | <= |
| <script> if ("Smith"<="Small") {document.write("Group 1")} else {document.write("Group 2")} </script> |
| <script> if("Mary"&&"Sally"||"Jane"|"Joan") document.write("You're Invited!!) </script> |
| Boolean Operators | |
| Symbol | Represents |
| && | "And" (both true) |
| || | "Or" (only 1 true) |
| | | "Not" (negative true=false) |
JS Test-Bed 1 - - JS Test-Bed 2
| << Previous | Next >> |