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

List of operators used in JavaScript

Revision as of 06:53, 9 August 2012 by Sanjay (Talk | contribs)

Jump to: navigation, search
Previous Page Home Page Next Page
ICT Applications

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:

Java Script Operators

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