JavaScript operators are used to perform an operation. There are different types of operators for different uses.
Below is a listing of JavaScript operators and a brief description of them. Don't worry if you don't understand all of them at this stage - just bookmark this page for reference and return whenever you need to.
Artithmetic Operators
Operator | Description |
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus (remainder of a division) |
++ | Increment |
-- | Decrement |
Assignment Operators
Operator | Description |
= | Assign |
+= | Add and assign. For example, x+=y is the same as x=x+y. |
-= | Subtract and assign. For example, x-=y is the same as x=x-y. |
*= | Multiply and assign. For example, x*=y is the same as x=x*y. |
/= | Divide and assign. For example, x/=y is the same as x=x/y. |
%= | Modulus and assign. For example, x%=y is the same as x=x%y. |
Comparison Operators
Operator | Description |
== | Is equal to |
=== | Is identical (is equal to and is of the same type) |
!= | Is not equal to |
!== | Is not identical |
> | Greater than |
>= | Greater than or equal to |
< | Less than |
<= | Less than or equal to |
Logical/boolean Operators
Operator | Description |
&& | and |
|| | or |
! | not |
String Operators
In JavaScript, a
string is simply a piece of text.
Operator | Description |
= | Assignment |
+ | Concatenate (join two strings together) |
+= | Concatenate and assign |
You will learn how to use some of the most common of these JavaScript operators in the following pages.
No comments:
Post a Comment