• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 4. Using Operators and Expressions > General Operators in JavaScript

General Operators in JavaScript

The everyday garden-variety operators seen in a typical JavaScript program are very similar or identical to the operators found in programs such as C++ or Java. If you have a Basic or Visual Basic programming background, you will find many similarities as well between JavaScript operators and what they use in different types of Basic. However, while a quick glance at the operators shows where the operators are similar and where they differ from your previous programming experience, be sure to take that glance. For readers who are taking up JavaScript as their first language, spend some time going over the examples and descriptions of what the operators do (see Table 4.1).

Table 4.1. JavaScript Operators
Symbol Operation
+ Add or concatenate
Subtract, or negative
* Multiply
/ Divide
% Modulus (remainder)
++ Increment

Symbol Operation
- Decrement
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
&& Logical AND
|| Logical OR
! Logical NOT
= = Test for equality
= = = Test for strict equality
! = Test for inequality
! = = Test for strict inequality
= Assignment
+ = Add and assign
− = Subtract and assign
* = Multiply and assign
% = Modulus and assign
/= Divide and assign
( ) Function arguments
. Structure member (called a dot) in structure or property
, Multiple evaluation
[ ] Array elements (access, index)
, Multiple evaluation
? : Ternary operator
new Constructor
delete Remove a variable
typeof Data type
void Return undefined value

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint