Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc76134

Browse files
committed
Improved layout of exercises
1 parent 02a4aae commit fc76134

File tree

1 file changed

+111
-58
lines changed

1 file changed

+111
-58
lines changed

fundamentals/exercises.md

Lines changed: 111 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,49 @@ var x = s.toLowerCase();
88
var l = s.length;
99
```
1010

11-
Indicate the type of each:
11+
**1. Indicate the type of each:**
1212

13-
A. `s`
14-
B. `x`
15-
C. `s.toLowerCase( )`
16-
D. `s.toLower Case`
17-
E. `s.length`
18-
F. `l`
13+
A. `s`
14+
B. `x`
15+
C. `s.toLowerCase( )`
16+
D. `s.toLower Case`
17+
E. `s.length`
18+
F. `l`
1919

20-
### In `var x = 5 + 6;`, what is `+`?
20+
----
2121

22-
A. Function
23-
B. Operator
24-
C. Number
25-
D. Aggregator
22+
### 2. In `var x = 5 + 6;`, what is `+`?
2623

27-
### In `var x = 5 + 6;`, what is 'var'?
24+
A. Function
25+
B. Operator
26+
C. Number
27+
D. Aggregator
2828

29-
A. Variable
30-
B. Keyword
31-
C. Operator
32-
D. Constant
29+
----
30+
31+
### 3. In `var x = 5 + 6;`, what is 'var'?
32+
33+
A. Variable
34+
B. Keyword
35+
C. Operator
36+
D. Constant
37+
38+
----
3339

3440
### Given the following code:
3541

3642
```js
3743
var x = z[y];
3844
```
3945

40-
What is `y`:
46+
**4. What is `y`?**
4147

42-
A. Index
43-
B. Key
44-
C. Index or key
45-
D. Array
48+
A. Index
49+
B. Key
50+
C. Index or key
51+
D. Array
52+
53+
----
4654

4755
### Given the following code:
4856

@@ -52,12 +60,41 @@ var x = [1, 2, 3];
5260
var z = x[y];
5361
```
5462

55-
What is `y`:
63+
**5. What is `y`?**
64+
65+
A. Index
66+
B. Key
67+
C. Index or key
68+
D. Array
69+
70+
----
71+
72+
### Given the following code:
73+
74+
```js
75+
var joe = {
76+
name: 'Joe',
77+
age: 24
78+
};
79+
var joesName = joe.name;
80+
var joesAge = joe['age'];
81+
```
82+
83+
**6. What is `'age'` in the last line?**
5684

5785
A. Index
5886
B. Key
59-
C. Index or key
60-
D. Array
87+
C. Property
88+
D. Object
89+
90+
**7. What are `name` and `age` of the object `joe`?**
91+
92+
A. Index
93+
B. Key
94+
C. Object
95+
D. Property
96+
97+
----
6198

6299
### Given the following code:
63100

@@ -67,32 +104,45 @@ var x = [1, 2, 3];
67104
var z = x[y];
68105
```
69106

70-
What is `y`:
107+
**7. What is `y`**
71108

72-
A. Index
73-
B. Key
74-
C. Index or key
75-
D. Array
109+
A. Index
110+
B. Key
111+
C. Index or key
112+
D. Array
76113

114+
**8. What is the element for index `1` in array `x`?**
77115

78-
### What is the name of these functions?
116+
**9. Fill in: "The value of the (...) `length` of `x` is (...)"**
79117

80-
A. `function a() { return true; }`
81-
B. `var a = function b() { return true; }`
82-
C. `var c = function () { return true; }`
118+
----
83119

84-
### Write a function that has two parameters called `first` and `second`
120+
### 10. What is the name of these functions?
85121

86-
### Write a function call that passes three arguments.
122+
A. `function a() { return true; }`
123+
B. `var a = function b() { return true; }`
124+
C. `var c = function () { return true; }`
87125

88-
### Write code for the following
126+
----
89127

90-
A. Declare a variable called `x` and initialize it with the string "Hello".
91-
B. Declare a variable called `y` and initialize it with the property `length` of `x`.
92-
C. Declare a variable called `z` and initialize it with the result of calling the method `toUpperCase` on `x`
93-
D. Declare a function called `myFunction`. This function should take two arguments, and should call the second argument with the first argument as its argument. Then, declare a variable called `f` and initialize it with an empty anonymous function, and call `myFunction` with the arguments `10` and `f`.
128+
### 11. Write a function that has two parameters called `first` and `second`
94129

95-
### Explain as precisely as possible (in English) what the following code does, line by line
130+
----
131+
132+
### 12. Write a function call that passes three arguments.
133+
134+
----
135+
136+
### 13. Write code for the following
137+
138+
A. Declare a variable called `x` and initialize it with the string "Hello".
139+
B. Declare a variable called `y` and initialize it with the property `length` of `x`.
140+
C. Declare a variable called `z` and initialize it with the result of calling the method `toUpperCase` on `x`
141+
D. Declare a function called `myFunction`. This function should take two arguments, and should call the second argument with the first argument as its argument. Then, declare a variable called `f` and initialize it with an empty anonymous function, and call `myFunction` with the arguments `10` and `f`.
142+
143+
----
144+
145+
### 14. Explain as precisely as possible (in English) what the following code does, line by line
96146

97147
(Tip: it should look like the items in the previous question!)
98148

@@ -104,27 +154,29 @@ var s = sum(4, 5);
104154
var r = Math.sqrt(s);
105155
```
106156

157+
----
107158

108-
## Arrays & objects
159+
### 15. Indicate for each of these whether it is an expression or a statement:
109160

161+
A. `l`
162+
B. `l = 4;`
163+
C. `l == 4`
164+
D. `if (l == 4) { console.log("yes"); }`
165+
E. `console.log("yes");`
166+
F. `"yes"`
167+
G. `console.log(l == 4 ? "yes" : "no")`
168+
H. `function a() { return 4; }`
169+
I. `var a = function () { return 4; }`
110170

111-
## Statements & expressions
171+
----
112172

113-
### Indicate for each of these whether it is an expression or a statement:
173+
### 16. How can you tell whether something is a statement?
114174

115-
A. `l`
116-
B. `l = 4;`
117-
C. `l == 4`
118-
D. `if (l == 4) { console.log("yes"); }`
119-
E. `console.log("yes");`
120-
F. `"yes"`
121-
G. `console.log(l == 4 ? "yes" : "no")`
122-
H. `function a() { return 4; }`
123-
I. `var a = function () { return 4; }`
175+
----
124176

125-
### How can you tell whether something is a statement?
177+
### 17. How can you tell whether something is an expression
126178

127-
### How can you tell whether something is an expression
179+
----
128180

129181
### Given the following code:
130182

@@ -149,5 +201,6 @@ if (s2 == s1) {
149201
}
150202
```
151203

152-
A. List all 11 *statements* in the code above
153-
B. List all 23 *expressions* in the code above (BONUS!)
204+
**18. List all 11 *statements* in the code above**
205+
206+
**19. List all 23 *expressions* in the code above (BONUS!)**

0 commit comments

Comments
 (0)