Category | Subject | Sinopsys | Description | Example |
---|---|---|---|---|
Shorthand | x += y | x = x + y | ||
Shorthand | x -= y | x = x - y | ||
Shorthand | x *= y | x = x * y | ||
Shorthand | x /= y | x = x / y | ||
Shorthand | x %= y | x = x % y | ||
Shorthand | x <<= y | x = x << y | ||
Shorthand | x >>= y | x = x >> y | ||
Shorthand | x >>>= y | x = x >>> y | ||
Shorthand | x &= y | x = x & y | ||
Shorthand | x ^= y | x = x ^ y | ||
Shorthand | x pipe= y | x = x pipe y | ||
Comparison | == | Equal Returns true if the operands are equal x == y Returns true if x equals y | ||
Comparison | != | Not equal Returns true if the operands are not equal. x != y Returns true if x is not equal to y | ||
Comparison | > | Greater than Returns true if left operand is greater than right operand. x > y Returns true if x is greater than y | ||
Comparison | >= | Greater than or equal Returns true if left operand is greater than or equal to right operand. x >= y Returns true if x is greater than or equal to y | ||
Comparison | < | Less than Returns true if left operand is less than right operand. x < y Returns true if x is less than y | ||
Comparison | <= | Less than or equal Returns true if left operand is less than or equal to right operand. x <= y Returns true if x is less than or equal to y | ||
Logical | && | AND: Returns true if both logical expressions expr1 and expr2 are true. Otherwise, returns false | expr1 && expr2 | |
Logical | pipe pipe | OR: Returns true if either logical expression expr1 or expr2 is true. If both are false, returns false | expr1 | |
Logical | ! | NOT: If expr is true, returns false; if expr is false, returns true | !expr | |
Special | ?: (Conditional operator) | Syntax: condition ? expr1 : expr2 The conditional operator is the only JavaScript operator that takes three operands. This operator is frequently used as a shortcut for the if statement |
||
Special | , (comma operator) | Syntax: expr1, expr2 The comma operator evaluates both of its operands and returns the value of the second operand |
||
Special | delete | The delete operator deletes an object, an object's property, or an element at a specified index in an array | ||
Special | new | Syntax: objectName = new objectType (param1 [,param2] ...[,paramN]) The new operator creates an instance of a user-defined object type or of one of the built-in object types that has a constructor function |
||
Special | this | Syntax: this[.propertyName] The this keyword refers to the current object. In general, in a method this refers to the calling object |
||
Special | typeof | Syntax: typeof operand or typeof (operand) The typeof operator returns a string indicating the type of the unevaluated operand. operand is the string, variable, keyword, or object for which the type is to be returned. The parentheses are optional |
||
Special | void | Syntax: void (expression) or void expression The void operator specifies an expression to be evaluated without returning a value. expression is a JavaScript expression to evaluate. The parentheses surrounding the expression are optional, but it is good style to use them |
||
Special | in | |||
Special | instanceof | Returns a Boolean value indicating whether the left hand operand is of the object type specified in the right hand operand. Here object type refers to the name of the object you wish to test for, such as Date, String, Array etc. Use instanceof as a more clear-cut way of detecting the type of an object or variable versus typeof | var mycars=['Honda', 'Toyota', 'Ford']; alert(mycars instanceof Array) //alerts true, mycars is an Array object |