-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperators.js
More file actions
116 lines (88 loc) · 2.05 KB
/
Copy pathoperators.js
File metadata and controls
116 lines (88 loc) · 2.05 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// operators in js are special symbols that perform operations on one or more
// files in our js file system
// 1. Arithmetic operators
// addition
let sum = 5 + 3;
console.log(sum);
// subtraction
let difference = 10 - sum;
console.log(difference);
// multiplication
let product = sum * difference;
console.log(product);
// division
let quotient = product / 4;
console.log(quotient);
// modulus
let remainder = quotient % 3;
console.log(remainder);
// 2. Assignment operators
// These operators assign values to variables
// assignment
let x = 5;
console.log(x);
// addition assignment
let y = 5;
y += 1;
console.log(y);
// subtraction assignment
let z = 10;
z -= y;
console.log(z);
// 3. Comparison operators
// These operators compare values and return a boolean value
// Equal
console.log(-5+5 == "0");
// strict Equal
console.log(5 === "5");
// not Equal
console.log(5 != "5");
let u = 3;
let v = 2;
console.log(u != "v")
// strict not Equal
console.log(5 !== "5");
let n = "raph";
let g = 10;
console.log(n !== g);
// Greater than
console.log(10 > 5);
let h = 12;
let k = 10;
let s = h + k;
console.log(k > h);
// less than
console.log(3 < 2);
let l = 12;
let i = 10;
let w = l - i;
console.log(s < w);
// greater than and equal to
console.log(4 >= 5);
let q = 6
let r = 6
let b = q * 2
console.log(q >= r);
let o = v - 3
console.log(b >= o);
// using logical operators declare four variables that logs boolean variable on console
// using comments on the vs code editor explain the meaning and how it functions.
// 4. Logical operators
// logical AND [&&]
const hasDriverLicense = true;
const hasInsurance = true;
const carDrive = hasDriverLicense && hasInsurance;
console.log(carDrive);
const isAdult = true;
const isHungry = false;
const canEnter = isAdult && isHungry;
console.log(canEnter);
// logical OR [||]
const knowsHTML = false;
const knowsCSS = true;
const canDesignWebsite = knowsHTML || knowsCSS;
console.log(canDesignWebsite);
const isAdmin = false;
const isSuperUser = false;
const canAccessPage = isAdmin || isSuperUser;
console.log(canAccessPage);