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
94 lines (77 loc) · 2.17 KB
/
app.js
File metadata and controls
94 lines (77 loc) · 2.17 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
console.log("Hello World!\n==========\n");
console.log(
"Follow the steps in the README.md file to complete the exercises:\n==========\n"
);
// Exercise 1
let a = 20;
let b = 40;
let add = a + b;
let minus = a - b;
let multiply = a * b;
let divide = a / b;
console.log(add);
console.log(minus);
console.log(multiply);
console.log(divide);
// Exercise 2
let num = 11;
let str = "11";
let str2 = "eleven";
let isPresent = true;
let firstName = "Frodo";
let lastName = "Baggins";
/*
What is the value of: num + str?
What is the value of: num + str2?
What is the value of: num + isPresent?
What is the value of: firstName + num?
What is the value of: isPresent + str?
What is the value of: firstName + lastName?
*/
let val1 = num + str; // "2011"
let val2 = num + str2; // "11eleven"
let val3 = num + isPresent; // 12
let val4 = firstName + num; // "Frodo11"
let val5 = isPresent + str; // "true11"
let val6 = firstName + lastName; // "FrodoBaggins"
console.log(val1);
console.log(val2);
console.log(val3);
console.log(val4);
console.log(val5);
console.log(val6);
// Exercise 3
console.log("EXERCISE 3:\n==========\n");
let val = 5;
let str3 = "5";
let str4 = "five";
let isPresent2 = false;
/*
What is the value of: val == str3?
What is the value of: val === str3?
What is the value of: !isPresent2?
What is the value of: (“eleven” == str4 && val >= str3)?
What is the value of: (!isPresent2 || isPresent2)?
What is the value of: 0 == false?
What is the value of: 0 === false?
What is the value of: 0 != false?
What is the value of 0 !== false?
*/
let val7 = val == str3; // true
let val8 = val === str3; // false
let val9 = !isPresent2; // true
let val10 = ("eleven" == str4 && val >= str3); // false
let val11 = (!isPresent2 || isPresent2); // true
let val12 = 0 == false; // true
let val13 = 0 === false; // false
let val14 = 0 != false; // false
let val15 = 0 !== false; // true
console.log(val7);
console.log(val8);
console.log(val9);
console.log(val10);
console.log(val11);
console.log(val12);
console.log(val13);
console.log(val14);
console.log(val15);