forked from truecodersio/JavaScript_Operators
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
136 lines (98 loc) · 2.72 KB
/
app.js
File metadata and controls
136 lines (98 loc) · 2.72 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
console.log("Hello World!\n==========\n");
console.log(
"Follow the steps in the README.md file to complete the exercises:\n==========\n"
);
// Exercise 1
console.log("EXERCISE 1:\n==========\n");
let a = 20;
let b = 4;
let add = a + b;
let minus = a - b;
let mutiply = a * b;
let dividing = a / b;
console.log(a); // 20
console.log(b); // 4
console.log(add); // 24
console.log(minus); // 16
console.log(mutiply); // 80
console.log(dividing); // 5
// Exercise 2
console.log("EXERCISE 2:\n==========\n");
let num = 11;
let str = "11";
let str2 = "eleven";
let isPresent = true;
let firstName = "Frodo";
let lastName = "Baggins";
console.log(num + str); // 1111
console.log(num + str2); // 11eleven
console.log(num + isPresent); // 12
console.log(firstName + num); // Frodo11
console.log(isPresent + str); // true11
console.log(firstName + lastName); // FrodoBaggins
/*
order - - -
depends on the operation being performed
1. strings
2. numbers
3. boolean
What is the value of: num + str?
1111 -- taking the string side
What is the value of: num + str2?
11eleven
What is the value of: num + isPresent?
?? - dont know - maybe numbers
boolean can compute to numbers True - 1 or False - 0
What is the value of: firstName + num?
Frodo11
What is the value of: isPresent + str?
true11
What is the value of: firstName + lastName?
FrodoBaggins
*/
// YOUR CODE HERE
// Exercise 3
console.log("EXERCISE 3:\n==========\n");
let val = 5;
let str3 = "5";
let str4 = "five";
let isPresent2 = false;
console.log(val == str3); // true
console.log(val === str3); // false
console.log(!isPresent2); // true
console.log("eleven" == str4 && val >= str3); // false
console.log((!isPresent2 || isPresent2)); // true
console.log(0 == false); // true
console.log(0 === false); // false
console.log(0 != false); // false
console.log(0 !== false); // true
//What is the value of: val == str3?
// true
// loosely checking
//What is the value of: val === str3?
// strickly
// false
//What is the value of: !isPresent2?
// not isPresent2 with are starting with false - we are saying not false
// so it makes the answer true
//What is the value of: (“eleven” == str4 && val >= str3)?
// two expressions to check
// left side - both strings -- false &&
// right side number 5 and "5" - evaluate as numbers - true
//What is the value of: (!isPresent2 || isPresent2)?
// as long is one side is true - left side is true
// answer is true
//What is the value of: 0 == false?
// true
// loose sense 0 = F
//What is the value of: 0 === false?
// false
//What is the value of: 0 != false?
// false
//What is the value of 0 !== false?
// true
// YOUR CODE HERE
// = assignment
// == loose
// === strict
// - - - think as operators