List of operators used in JavaScript
Previous Page | Home Page | Next Page |
---|
Operators
An operator is used to transform one or more values into a single resultant value. In JavaScript, operators are used in expressions to store or return a value.
JavaScript operators are classified as:
* Arithmetic
* Logical
* Comparison
* String
An operator operates on operand or operands. The combination of one or more operators is referred to as an expression.
For example: netPayment=netPrice+salesTax
In this example “+” operator operates on operand netPrice and salesTax and its result assigned to variable net Payment.
The following table shows the list of operators used in JavaScript:
Expressions
An expression is a part of statement that is evaluated as value.An expression can be any combination of variables, operators and other expressions. In JavaScript there are four types of expressions:
- Assignment expression
- Arithmetic expression
- String expression
- Logical expression
- Assignment expression
This expression is used to assign a value to a variable.Example: avgMarks=55, the value 55 has been assigned to the variable avgMarks using assignment operator (=)
Arithmetic Expressions
Expressions in which arithmetic operations are performed are called arithmetic expression.Example: netPrice=1200+12
String Expression
Expressions in which operations are performed on string are called string expression.Example: mesg= "Hello," + "Mr. Rakesh", Here "+" string operator concatenate two strings "Hello, " and "Mr. Rakesh" results "Hello,Mr. Rakesh" that is assigned to variable mesg.
Logical Expression
These expressions evaluate to a Boolean (true or false) value.Example: 10<19, since 10<19, this expression evaluates to the Boolean value of true.
Previous Page | Home Page | Next Page |
---|