=. x = x operator y.+=.-=.*=./= .%= .<<= .>>= .>>>= .&= .^= .|= .+. Addition. Can also be used as a unary operator that can type-convert to a number type.-. Subtraction.*. Multiplication./. Division.%. Modulus: return integer remainder. EG: 13 % 5 returns 3.++. Unary increment operator. Can be used before the operand to return the new result, or after the operand to return the old result.--. Unary decrement operator. Can be used before or after the operand.-. Unary operator. Changes sign of operand.&. Bitwise AND, returns 1s for bit positions where both operands are 1, eg 10 & 12 yields 8, since 1010 and 1100 yields 1000.|. Bitwise OR, returns 1s for bit positions where either operand is 1. EG: 10 | 12 yields 14, since 1010 and 1100 yields 1110.^. Bitwise XOR, returns 1s for bit positions where either operand is 1 but not both. EG: 10 ^ 12 yields 6, since 1010 and 1100 yields 0110.~. Bitwise NOT, inverts the operand, eg. ~10 yields 5, since 1010 yields 0101.<<. Shift binary a to the left b places and pad the right side with b 0s. EG: 9 << 2 yields 36 since 1001 becomes 100100.>>. Shift binary a to the right b places and discard the b rightmost digits. EG: 9 >> 2 yields 2 because 1001 becomes 10.>>>. Shift binary a to the right b places and discard the b rightmost digits then pad the left with 0s. EG: 9 >> 2 yields 2 because 1001 becomes 10. For non-negative numbers, >> and >>> yield the same results.if ... else shorthand. This makes the order of operands relevant!&&. And. Returns A if A converts to false, otherwise returns B.
if(!A)A; else B; //in JS 1.1+ if(!A)false; else (B); //in JS 1.0 false && false //returns false false && true //returns false true && false //returns false true && true //returns true 0 && "bat" //returns 0 "ape" && 0 //returns 0 "ape" && "bat" //returns "bat"
||. Or. Returns A if A converts to true, otherwise returns B.
if(A)A; else B; //in JS 1.1+ if(A)true; else (B); //in JS 1.0 false || false //returns false false || true //returns true true || false //returns true true || true //returns true 0 || "bat" //returns "bat" "ape" || 0 //returns "ape" "ape" || "bat" //returns "ape"
!. Not. A unary operator that inverts the operand. if(a)false;else true;. EG: !(true) yields false.!!. Not not. A unary operator that can type-convert to a boolean type. It is really just two ! operators. EG: !!(true) yields true.NaN is not equal to anything, including NaN. Null and Undefined are equal.==. Equal. True if operand values are equal. A data type conversion is performed if needed. EG: 5=="5" returns true. Objects must have same address space. EG: a1=new a; a2=new a; thus a1==a2 returns false.!=. Not equal.===. Strict equal. True if operand values and data types are equal. EG: 5==="5" returns false. Objects must have same address space. EG: a1=new a; a2=new a; thus a1===a2 returns false.!==. Strict not equal.
>.<.>=.<=.+. Note that the plus sign is used as both an arithmetic and a string operator. EGs:8 + 8 // 16 "8" + 8 // "88" 8 + "8" // "88" "8" + "8" // "88" 8 + 8 + "8" // "168" 8 + "8" + 8 // "888"
+=. EG: strResult += "is super".condition ? StatementIfTrue : StatementIfFalse. Shorthand for if(condition) StatementIfTrue else StatementIfFalse. It is generally used to select between one of two values.,. Comma operator. Evaluates both operands but returns the second.
//This prints the values of the diagonal elements in the array:
for (i=0, j=9; i <= 9; i++, j--)
document.writeln("a[" + i + ", " + j + "] = " + a[i, j])
//This returns x, y, z as 7, 5, 7 respectively:
x = ( y = 5, z = 7);
delete objectName
delete objectName.property
delete objectName['property']
delete objectName[index]
delete property //use only within a with statement.delete Foo.prototype.bar.propertyNameOrNumber in objectName. Returns true if the specified property is in the specified object.objectName instanceof objectType. Returns true if the specified object is of the specified object type.objectName = new objectType (param1 [,param2] ...[,paramN]). Creates an instance of a user-defined object type or of one of the built-in object types that has a constructor function.this. Refers to the object that the current function is a method of. See The this keyword [http://www.quirksmode.org/js/this.html]. EG: onChange="run(this, 12)". EG: function doX(){ this.style.color = 'red'; }.typeof expression
typeof (expression). Returns string indicating data type. The 6 possible strings returned are: string, number, boolean, object (includes null, arrays, and regexps), function, or undefined. In an ideal world null, array, and regexp would be their own types in order to match the 9 JS Standard objects.void (expression)
void expression. Evaluates expression but returns nothing, i.e. returns undefined. EG: <a href="void(document.form.submit())">Click here to submit</a>.From low to high:
Page Modified: (Hand noted: 2008-04-30 21:12:20Z) (Auto noted: 2009-04-02 19:58:02Z)