# Difference between revisions of "List of operators used in JavaScript"

Line 34: | Line 34: | ||

[[File:javascript3.png|center|Java Script Operators|800px]] | [[File:javascript3.png|center|Java Script Operators|800px]] | ||

− | === Expressions=== | + | ===<font color=green> Expressions</font>=== |

An expression is a part of statement that is evaluated as value.An expression can be any combination of variables, operators andother expressions. In JavaScript there are four types ofexpressions: | An expression is a part of statement that is evaluated as value.An expression can be any combination of variables, operators andother expressions. In JavaScript there are four types ofexpressions: | ||

Line 44: | Line 44: | ||

This expression is used to assign a value to a variable.Example: avgMarks=55, the value 55 has been assigned to thevariable avgMarks using assignment operator (=) | This expression is used to assign a value to a variable.Example: avgMarks=55, the value 55 has been assigned to thevariable avgMarks using assignment operator (=) | ||

− | ====Arithmetic Expressions==== | + | ====<font color=green>Arithmetic Expressions</font>==== |

Expressions in which arithmetic operations are performed arecalled arithmetic expression.Example: netPrice=1200+12 | Expressions in which arithmetic operations are performed arecalled arithmetic expression.Example: netPrice=1200+12 | ||

− | ====String Expression==== | + | ====<font color=green>String Expression</font>==== |

Expressions in which operations are performed on string arecalled string expression.Example: mesg= "Hello," + "Mr. Rakesh", Here "+" string operatorconcatenate two strings "Hello, " and "Mr. Rakesh" results "Hello,Mr. Rakesh" that is assigned to variable mesg. | Expressions in which operations are performed on string arecalled string expression.Example: mesg= "Hello," + "Mr. Rakesh", Here "+" string operatorconcatenate two strings "Hello, " and "Mr. Rakesh" results "Hello,Mr. Rakesh" that is assigned to variable mesg. | ||

− | ====Logical Expression==== | + | ====<font color=green>Logical Expression</font>==== |

These expressions evaluate to a Boolean (true or false) value.Example: 10<19, since 10<19, this expression evaluates to theBoolean value of true. | These expressions evaluate to a Boolean (true or false) value.Example: 10<19, since 10<19, this expression evaluates to theBoolean value of true. | ||

## Revision as of 11:09, 22 January 2013

Previous Page | Home Page | Next Page |
---|

### Operators

An operator is used to transform one or more values into a singleresultant value. In JavaScript, operators are used in expressions tostore or return a value.

JavaScript operators are classified as:

*** Arithmetic**

*** Logical**

*** Comparison**

*** String**

An operator operates on operand or operands. The combination of oneor more operators is referred to as an expression.

For example: netPayment=netPrice+salesTax

In this example “+” operator operates on operand netPrice andsales Tax 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 andother expressions. In JavaScript there are four types ofexpressions:

- 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 thevariable avgMarks using assignment operator (=)

#### Arithmetic Expressions

Expressions in which arithmetic operations are performed arecalled arithmetic expression.Example: netPrice=1200+12

#### String Expression

Expressions in which operations are performed on string arecalled string expression.Example: mesg= "Hello," + "Mr. Rakesh", Here "+" string operatorconcatenate 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 theBoolean value of true.

Previous Page | Home Page | Next Page |
---|