Animations
API
Arrays
Async
Basics
Challenges
Classes
Console
Dates
Debugging
DOM Elements
DOM Methods
DOM Properties
Event Listeners
Flow Control
Forms
Functions
Global Functions
JSON
Keywords
Libraries (3rd party)
Math
Modules
Objects
Snippets
String
Types
Widgets
Window Object
Arithmetic Operators
+ | Addition | |
- | Subtraction | |
* | Multiplication | |
/ | Division | |
% | Modulus | |
++ | Increment | |
-- | Decrement |
Assignment Operators
= | x = y | x = y |
+= | x += y | x = x + y |
-= | x -= y | x = x - y |
*= | x *= y | x = x * y |
/= | x /= y | x = x / y |
%= | x %= y | x = x % y |
Comparison and Logical Operators
== | equal to | |
=== | equal value and equal type | |
!= | not equal | |
!=== | not equal value or not equal type | |
> | greater than | |
< | less than | |
>= | greater than or equal to | |
<= | less than or equal to | |
? | ternary operator |
Type Operators
typeof | Returns the type of a variable | |
instanceof | Returns true if an object is an instance of an object type |
Operator Examples
()) | Expression grouping | (3 + 4) |
. | Member | person.Name |
[] | Member | person["Name"] |
function() | Function call | MyFunction(); |
new | Create | new Person(); |
++ | Post Increment | counter++; |
-- | Post Decrement | counter--; |
++ | Pre Increment | ++counter; |
-- | Pre Decrement | --counter; |
! | Not / False | !isValid; |
typeof | Type | typeof person; |
* | Multiplication | 1 * 2; |
/ | Division | 4 / 2; |
% | Modulus | 4 % 2; |
** | Exponentiation | 4 ** 2; |
+ | Addition | 4 + 2; |
- | Subtraction | 4 - 2; |
<< | Zero fill left shift | 0101 << 1 = 1010 (bits) |
>> | Zero fill right shift | 0101 >> 1 = 0010 (bit) |
< | Less than | 1 < 2 |
< | Less than or equal to | 1 < =2 |
> | Greater than | 10 > 2 |
>= | Greater than or equal to | 10 >= 2 |
== | Equal value | true == "false" |
=== | Equal value and type | false === "false" |
!= | Not equal value | isGood != "false" |
!= | Not equal value and type | isGood !== false |
&& | And | isValid = isGood && isGreat |
= | Assignment | isNotValid == isDeleted || isBad |
|| | Or | isNotValid == isDeleted || isBad |
= | Assignment | x = y; |
+= | Assignment | x += y; |
-= | Assignment | x -= y; |
*= | Assignment | x *= y; |
/= | Assignment | x /= y; |