OperatorsJavaScript
@Ahmed Murtaza
Unary Operators++x [pre-increment]
X++ [post-increment]
--x [pre-decrement]
X-- [post-decrement]
typeof(x)
Binary Operators
Arithmetic operators
Assignment operators
Comparison operators
Logical operators
Arithmetic Operators
+ { x + y }
- { x - y }
* { x * y }
/ { x / y }
% { x % y }
Riddle•Use all five operators ( + - * / % )
•The answer should be 27
(operators should be in same sequence)
Assignment Operators= { x = y }
+= { x += y}
-= { x -= y}
*= { x *= y}
/= { x /= y}
%= { x %= y}
Comparison Operators== { x == y }
=== (strict) { x === y }
> { x > y }
< { x < y }
>= { x >= y }
<= { x <= y }
!== (strict) { x !== y }
!= { x != y }
Logical Operators&& (AND) { x < y && x > z }
|| (OR) { x < y || x > z }
! (NOT) { x != y }
Ternary Operators
Condition ? expression1 : expression2
Example ::
(10 === ‘10’) ? alert(“Equal”) : alert(“Not Equal”);
By ::
Ahmed Murtaza@ahmedgmurtaza
Top Related