Operator | Comments |
---|
+ - * / | standard math operators |
() | for controlling order of operations |
|| | logical or. e.g. true || false === true |
&& | logical and. e.g. true && false === false |
! | logical not e.g. !true === false |
? : | Conditional (ternary) operator - The conditional (ternary) operator is the only operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:), and finally the expression to execute if the condition is falsy. This operator is like an if...else statement. For example:(true ? "A" : "B") === "A" (false ? "A" : "B") === "B"
|
== | Type insensitive equality. Forgives differences in types. e.g. ("1" ==1) === true |
=== | Type sensitive equality. Types matter. e.g. ("1"===1) === false |
!= | Type insensitive non-equality. Forgives differences in types. e.g. ("1" !=1) === false |
!== | Type sensitive non-equality. Types matter. e.g. ("1"!==1) === true |
> >= < <= | Greater than, greater than or equal, less than, less than or equal |
, { } | Separators. Commas , separate parameters to functions. Some functions use braces { } to group data elements |