-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperators.js
More file actions
72 lines (53 loc) · 1.22 KB
/
Copy pathOperators.js
File metadata and controls
72 lines (53 loc) · 1.22 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//Arithmetic operators
// + - / *
let num_1 = 45;
let num_2 = 45;
// +
let result = num_1+num_2;
console.log(result);
// -
let result = num_1-num_2;
console.log(result);
// *
let result = num_1*num_2;
console.log(result);
// /
let result = num_1/num_2;
console.log(result);
// **
console.log(3**3)
// This will multiply 3 with 3 for 3 times
//Logical operators
// && || !
let num_1 = 56;
let num_2 = 45;
let num_3 = 35;
// &&
if((num_1 > num_2) && (num_1 > num_3)){
console.log("Num1 is greater")
}
// ||
let isStudent = false;
let hasID = true;
console.log(isStudent || hasID);
// !
let isStudent = true;
console.log(!isStudent);
// Assignment operator
// =
// used for assigning
let name = "Afaq";
// Assign the name afq to name variable
// += (add and assign)
let age =23;
3 += age
let result = age
// the age is 23 and then 3 is added and become equal to age and the the age is in result
// -=
// same as add and asign just it subtract instead of adding.
// *=
// same as add and asign just it multiply instead of adding.
// /=
// same as add and asign just it divide instead of adding.
// %=
// same as add and asign just it modules instead of adding.