Virtual Open Schooling Online courses available at Virtual Open Schooling (VOS), for more details kindly click here!
NIOS Silver Jubilee Year
NIOS

List of operators used in JavaScript

From NIOS
Revision as of 09:49, 2 March 2014 by Sarojpatro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Previous Page Home Page Next Page
ICT Applications

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:

JavaScript Operators

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
ICT Applications