You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Week1/MAKEME.md
+37-1Lines changed: 37 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ _Deadline Thursday_
57
57
58
58
> For all the following exercises create a new .js file. Try to find a proper name for each file or make a small comment about what it does inside for future reference. All these
59
59
60
-
1. Write a `console.log` statement saying "Hello World!" for each language that you know.
60
+
1\. Write a `console.log` statement saying "Hello World!" for each language that you know.
61
61
62
62
For example:
63
63
```
@@ -73,15 +73,20 @@ console.log('I'm awesome');
73
73
2\.1 Copy the code in your `.js` file and run it. You will see that you will get a SyntaxError. Find a solution for this error, Hint read the error message carefully, it also gives an indication of where the problem is.
74
74
75
75
3\. Declare a variable `x` and initialize it with an integer.
76
+
76
77
3\.1 First, _declare_ your variable `x`.
78
+
77
79
3\.2 Add a console.log statement that explains that explains in words what _you think_ the value of `x` is, like in this example:
78
80
```js
79
81
// TODO -> here you initialize your variable
80
82
console.log('the value of my variable x will be: whateverYouThinkItWillLog');
81
83
```
82
84
3\.3 Add a console.log statement that logs the value of `x`
85
+
83
86
3\.4 Now _initialize_ your variable `x` with an integer
87
+
84
88
3\.5 Now add a console.log statement that explains what _you think_ the value of `x` is.
89
+
85
90
3\.6 Add a console.log statement that logs the value of `x`.
86
91
Steps to be taken:
87
92
@@ -95,10 +100,15 @@ console.log('I'm awesome');
95
100
```
96
101
97
102
4\. Declare a variable `y` and assign a string to it.
103
+
98
104
4\.1 Write a console.log statement in which you explain in words what _you think_ the value of the string is
105
+
99
106
4\.2 Now console.log the variable `y`.
107
+
100
108
4\.3 Now assign a new string to the variable `y`
109
+
101
110
4\.4 Just like you did before write a console.log statement that explains in words what you think will be logged to the console.
111
+
102
112
4\.5 Now console.log `y` again.
103
113
```js
104
114
// TODO -> here you declare AND assign your string
@@ -110,38 +120,60 @@ console.log('I'm awesome');
110
120
```
111
121
112
122
5\. How do you round the number 7.25, to the nearest integer?
123
+
113
124
5\.1 Declare a variable `z` and assign the number 7.25 to it.
125
+
114
126
5\.2 Console.log `z`.
127
+
115
128
5\.3 Declare another variable `a` that has the value of z but rounded to the nearest integer.
129
+
116
130
5\.4 Console.log `a`
131
+
117
132
5\.5 So now we have `z` and `a` find a way to compare the two values and store the highest of the two in a new variable.
133
+
118
134
5\.6 Console.log the highest value.
119
135
120
136
6\. Arrays!
137
+
121
138
6\.1 Declare an empty array (you can decide on how to call it yourself, but read on a bit here and see if you can find a good name that exactly describes what this variable will hold).
139
+
122
140
6\.2 Write a console.log statement that explains in words what you think the value of the array is.
141
+
123
142
6\.3 Console.log your array.
143
+
124
144
6\.4 Create an array that has your favorite animals inside
145
+
125
146
6\.5 Log your array
147
+
126
148
6\.6 Add a statement that adds Daan's favorite animal (baby pig) to the *existing array*
149
+
127
150
6\.7 Log your new array!
128
151
129
152
7\. More strings
153
+
130
154
7\.1 Let's consider the following string: `let myString = "this,is,a,test"`.
155
+
131
156
7\.2 Add the string to your file and console.log it.
157
+
132
158
7\.3 Find a way to get the length of `myString`.
159
+
133
160
7\.4 Console.log the length of `myString`.
134
161
135
162
8\. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type.
163
+
136
164
8\.1 First declare at least four variables and assign them different data types.
165
+
137
166
8\.2 For each variable write a `console.log` statement that logs the value
138
167
```js
139
168
let foo =3;
140
169
console.log('The value of my variable foo is: '+ foo);
141
170
```
142
171
8\.3 Now write a console.log statement wherein you first explain in words what you think the _type_ of your variables is.
172
+
143
173
8\.4 Now use `typeof` to log the actual _type_ of your variables.
174
+
144
175
8\.5 Now compare the types of your different variables with one another.
176
+
145
177
8\.6 Make sure to also show a message when the variables you are comparing are not the same type.
146
178
147
179
For example:
@@ -157,11 +189,15 @@ if () {
157
189
```
158
190
159
191
9\. If `x` equals 7, and the only other statement is `x = x % 3`, what would be the new value of `x`?
192
+
160
193
9\.1 Add at least 3 `console.log` statements in which you show that you understand what `%` does.
161
194
162
195
10\. Write a program to answer the following questions:
196
+
163
197
10\.1 Can you store multiple types in an array? Numbers and strings? Make an example that illustrates your answer.
198
+
164
199
10\.2 Can you compare infinities? (Not in Eyad's world) - does 6/0 === 10/0? How can you test this?
200
+
165
201
10\.3 Add console.log statements to the above program's in which you show that you understand the concepts (just like you've done in the above assignments).
0 commit comments