Most people can modify existing JavaScript code
just by using common sense.
But you might need to know what many of the following symbols do.
| JavaScript Operands & Symbols | |
| Javascript Overview | Javascript Operands | Javascript Commands | |
|
Most people can modify existing JavaScript code
just by using common sense. But you might need to know what many of the following symbols do. |
|
| /* */ | /* Multiline comments */ (just like CSS comments). |
| // | Single line comment (ignored by the interpreter: not executed). Ex: // This line calculates tax |
| ; | Used to end each JavaScript statement (just like CSS statements). |
| { | Begin a JavaScript block of code. Ex: if (firstName == "") {alert("First Name required");} |
| } | End a JavaScript block of code. (just like CSS statements). |
| \n | Start a new line. Ex: alert("Hello\nBye"); |
| \' | Insert an apostrophe. Ex: alert('Aren\'t you smart?'); |
| ++ | To increment: a Counter. Ex: count++ |
| -- | To decrement or count backward. |
| = | Assignment, such as this equals. Ex: var taxRate = .07 |
| == | Comparison, such as are these equal? Ex: if (firstName == "") {alert("First Name required");} |
| != | Unequal |
| <= | Less Than or Equal |
| >= | Greater Than or Equal |
| + | Add or Concatenate, Ex1. x = a + b Ex2. fullName = firstName + " " + lastName |
| && | Logical And. Ex: if (fullTime==true && hours > 40) {return (rate*40) + (hours-40)*rate*1.5));} |
| || | Logical Or. (two "piping" symbols - see above the [Enter] key) |
| ! | Logical Not. Ex: if (!taxable) {taxRate = 0;} else {taxRate = .07;} or if(!document.form1.lastName.value) { alert ("Name required") } |
| Top | Javascript Overview | Javascript Operands | Javascript Commands |