Wednesday, 17 September 2014

Types Of Operator......

                 Types Of Operator......

1) Unary Operator:-

The following operators are unary:
  • Increment: ++
  • Decrement: − −
  • Address: &
  • Indirection: *
  • Positive: +
  • Negative: −
  • One's complement: ~x
  • Logical negation: !x
  • Sizeof: sizeof x, sizeof(type-name)
  • Cast: (type-name) cast-expression
2)Binary Operator:-

A binary operator is an operator that operates on two operands and manipulates them to return a result.

Some common binary operators in computing include:
  • Equal (= =)
  • Not equal (! =)
  • Less than (<)
  • Greater than (>)
  • Greater than or equal to (> =)
  • Less than or equal to (< =)
  • Logical AND (&&)
  • Logical OR (||)
  • Plus (+)
  • Minus (-)
  • Multiplication (*)
  • Divide ( / )

3)Ternary Operator :-
                                          

syntax :- test ? expression 1 : expression 2

Parameter :-

testAny Boolean expression.
expression 1An expression returned if test is true. May be a comma expression.
expression 2An expression returned if test is false. More than one expression may be a linked by a comma expression.

For e.g :- 


var now = new Date();
var greeting = "Good" + ((now.getHours() > 17) ? " evening." : " day.");





No comments:

Post a Comment