-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathpset1.js
More file actions
110 lines (62 loc) · 1.79 KB
/
Copy pathpset1.js
File metadata and controls
110 lines (62 loc) · 1.79 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
/******************
PROBLEM 1:
What are the types of the following expressions and what do they evaluate to, and why?
-> 17
-> 1 + 2 * 3 + 4
-> 800 / 80 / 8
-> 400 > 200
-> 1 !== 1
-> true || false
-> true && false
-> 20 % 6
-> 'a' + 'b'
******************/
/******************
PROBLEM 2:
What will the following return? Why?
-> typeof 4
-> typeof 'hello'
-> typeof true
-> 2 === 1 || 3 === 4
******************/
/******************
PROBLEM 3:
Create a truth table for the expression A || B.
For reference, here is a truth table for the expression A && B:
| A | B | A && B|
| true | true | true |
| false | true | false |
| true | false | false |
| false | false | false |
******************/
/******************
PROBLEM 4:
Create a truth table for the expression !A && !B.
For reference, here is a truth table for the expression A && !B:
| A | B | !B | A &&!B|
| true | true | false | false |
| false | true | false | false |
| true | false | true | true |
| false | false | true | false |
******************/
/******************
PROBLEM 5:
Write a step-by-step evaluation for the following expression (remember order of operations): 2 + 3 * 2 + 1.
For reference, here is a exp of a step-by-step evaluation:
1 + 2 + 3 + 4
3 + 3 + 4
6 + 4
10
******************/
/******************
PROBLEM 6:
Write a step-by-step evaluation for the following expression (remember order of operations): 4 / 2 + 8 / 4.
******************/
/******************
PROBLEM 7:
Write a step-by-step evaluation for the following expression: 'ca' + 'ter' + 'pi' + 'llar'.
******************/
/******************
PROBLEM 8:
Write a step-by-step evaluation for the following expression: 2 * 4 === 8 && 'car' + 'pool' === 'carpool'.
******************/