Operator | Description | Example | Result |
---|---|---|---|
Plus sign (+) | Concatenates two strings. | 'a' + 'b'; | ab |
Operator | Description | Example | Result |
---|---|---|---|
Plus sign (+) | Adds two numbers. | 5 + 5; | 10 |
Hyphen (-) | Subtracts two numbers. | 10 - 5; | 5 |
Asterisk (*) | Multiplies two numbers. | 2 * 2; | 4 |
Forward slash (/) | Divides two numbers. | 9/2; | 4.5 |
Percent symbol (%) | Performs a modulo operation. This operation divides two numbers and returns the remainder. | 10%3; | 1 |
Logical operators appear in expressions that can be evaluated to TRUE or FALSE.
Operator | Example | Result |
---|---|---|
Less Than (<) | 5 < 10; | true |
Greater Than (>) | 10 > 5; | true |
Less Than or Equal To (<=) | 5 <= 5; | true |
Greater Than or Equal To (>=) | 5 >=5; | true |
Equal To (==) | '5'==5 | true |
Strictly Equal To (===) | 5==='5'; | false |
Not Equal To (!=) | '1'!=1; | false |
Not Strictly Equal To (!==) | '1'!=='1' | true |
And (&&) | true && false; | false |
Or (||) | true || false; | true |
Operator | Description |
---|---|
<< | Shift Left |
>> | Shift Right |
& | Bit-wise And |
| | Bit-wise Or |
^ | Bit-wise Xor |