-
Notifications
You must be signed in to change notification settings - Fork 0
/
_operator.js
33 lines (28 loc) · 1015 Bytes
/
_operator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Operators in Javascript
/*
In 3 + 3 '+' is the operator and , 3,3 are operands
1. Unary operator It has single operand 'a = -a'
Example:
aa = -aa;
console.log(aa);
2. Binary operator It has single operand 'a = a + 1'
Example:
aa = 77 + 45;
console.log(aa);
Operand - Entities on which operators operate.
*/
// Variable
var num1 = 3;
var num2 = 2;
// print to browser developer console
// Arithemaric Operator
console.log("Arithematic Operation is : ", num1 + num2);
console.log("Arithematic Operation is : ", num1 - num2);
console.log("Arithematic Operation is : ", num1 * num2);
console.log("Arithematic Operation is : ", num1 / num2);
console.log("Square of ", num1, " is : ", num1 ** num2);
// Increment & Decrement Operator
console.log("Increment Operation is : ", num1++);
console.log("Increment Operation is : ", ++num1);
console.log("Decrement Operation is : ", num2--);
console.log("Decrement Operation is : ", --num2);