-
Notifications
You must be signed in to change notification settings - Fork 0
/
day2.js
46 lines (39 loc) · 1.23 KB
/
day2.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
34
35
36
37
38
39
40
41
42
43
44
45
46
//Arrithmatic Operators
let number1 = 34;
let number2 = 45;
console.log("Addition of two number is : ", number1 + number2);
console.log("substraction of Two number is : ", number1 - number2);
console.log("Multiplication of Two number is : ", number1 * number2);
console.log("division of Two number is : ", number1 / number2);
console.log("remainder of Two number is : ", number1 % number2);
//Assignment Operators
console.log("use of =+ operator : ", (number1 = +1));
console.log("use of =- operator : ", (number1 = -1));
//Comparision Operator
let n1 = 10;
let n2 = 20;
if (n1 > n2) console.log("n1 is greater than n2 ");
if (n1 < n2) console.log("n1 is less than n2 ");
//Logically Operator
console.log("use of && operator : ", n1 && n2);
if (n1 && n2 == 10) {
console.log("n1 and n2 are same ");
} else {
console.log("n1 and n2 are not same ");
}
console.log("use of || operator : ", n1 || n2);
if (n1 || n2) {
console.log("n1 or n2 are same ");
} else {
console.log("n1 or n2 are not same ");
}
//ternary Operator
// check the number where number is positive or negative
let positive = 40
let negative = -40
if(positive>0){
console.log("positive number is : ",positive)
}
else{
console.log("Negative number is : ",positive)
}