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
100 lines (80 loc) · 2.88 KB
/
app.js
File metadata and controls
100 lines (80 loc) · 2.88 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
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");
/* ## Exercise 1
1. Declare 2 variables, `a` and `b`, and assign 20 to `a` and 4 to `b`
2. Declare a variable `add` that uses the `+` operator to store the result of adding the values stored in `a` and `b`
3. Declare a variable `minus` that uses the `-` operator to store the result of subtracting the values stored in `a` and `b`
4. Declare a variable `multiply` that uses the `*` operator to store the result of multiplying the values stored in `a` and `b`
5. Declare a variable `dividing` that uses the `/` operator to store the result of dividing the values stored in `a` and `b`
You can print the value of the variables to the browser console (ex: `console.log(add)`) to check the result. */
// YOUR CODE HERE
// let a = 20;
// let b = 4;
// let add = a + b;
// let minus = a - b;
// let multiply = a * b;
// let dividing = a / b;
// console.log('a');
// console.log('b');
// console.log('add');
// console.log('minus');
// console.log('multiply');
// console.log('dividing');
// Exercise 2
console.log("EXERCISE 2:\n==========\n");
/* 1. Use the following code to answer the questions below:
``` */
// let a = 11;
// let str = "11";
// let str2 = "eleven";
// let isPresent = true;
// let firstName = "Jackie";
// let lastName = "Chan";
/* ```
- What is the value of: a + str? // "1111"
- What is the value of: a + str2? // "11eleven"
- What is the value of: a + isPresent? // Nan
- What is the value of: a + firstName? // "11Jackie"
- What is the value of: a + lastName? // "11Chan"
Use the code above to test and print the results. */
// YOUR CODE HERE
// console.log(a + str);
// console.log(a + str2);
// console.log(a + isPresent);
// console.log(a + firstName);
// console.log(a + lastName);
// Exercise 3
console.log("EXERCISE 3:\n==========\n");
/* 1. Use the following code to answer the questions below:
``` */
let a = 5;
let str = "5";
let str2 = "five";
let isPresent = false;
let firstName = "Robin";
let lastName = "Williams";
/* ```
- What is the value of: a == str? // true
- What is the value of: a === str? // false
- What is the value of: !isPresent? // true
- What is the value of: (“eleven” == str2 && a >= str)? // false
- What is the value of: (!isPresent || isPresent)? // true
- What is the value of: 0 == false? // true
- What is the value of: 0 === false? // false
- What is the value of: 0 != false? // false
- What is the value of 0 !== false? // true
Use the code above to test and print the results. */
// YOUR CODE HERE
console.log(a == str);
console.log(a === str);
console.log(!isPresent);
console.log('eleven' == str2 && a >= str);
console.log(!isPresent || isPresent);
console.log(0 == false);
console.log(0 === false);
console.log(0 != false);
console.log( 0 !== false);