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
{{ message }}
This repository was archived by the owner on May 14, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: Week2/MAKEME.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ On freeCodeCamp.com please do the [Basic JavaScript](https://www.freecodecamp.co
32
32
## Step 4: JavaScript
33
33
34
34
> 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.
35
-
35
+
---
36
36
1\. Write a `console.log` statement saying "Hello World!" for each language that you know.
37
37
38
38
For example:
@@ -41,15 +41,15 @@ Halo, dunia! // Indonesian
41
41
Ciao, mondo! // Italian
42
42
Hola, mundo! // Spanish
43
43
```
44
-
44
+
---
45
45
2\. Consider the following code:
46
46
47
47
```
48
48
console.log('I'm awesome');
49
49
```
50
50
51
51
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.
52
-
52
+
---
53
53
3\. Declare a variable `x` and initialize it with an integer, using these exact steps:
54
54
3\.1 First, _declare_ your variable `x` (do not initialize it yet).
55
55
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:
@@ -71,7 +71,7 @@ Copy the code in your `.js` file and run it. You will see that you will get a Sy
71
71
console.log('the value of x will be: whateverYouThinkItWillLog');
72
72
// TODO -> log value of x again
73
73
```
74
-
74
+
---
75
75
4\. Declare a variable `y` and assign a string to it.
76
76
4\.1 Write a console.log statement in which you explain in words what _you think_ the value of the string is.
77
77
4\.2 Now console.log the variable `y`.
@@ -86,15 +86,15 @@ Copy the code in your `.js` file and run it. You will see that you will get a Sy
86
86
console.log('the value of my string will be: whateverYouThinkItWillLog');
87
87
// TODO -> log the actual value of the string to the console
88
88
```
89
-
89
+
---
90
90
5\. How do you round the number 7.25, to the nearest integer (i.e., whole number)?
91
91
5\.1 Declare a variable `z` and assign the number 7.25 to it.
92
92
5\.2 Console.log `z`.
93
93
5\.3 Declare another variable `a` that has the value of z but rounded to the nearest integer.
94
94
5\.4 Console.log `a`.
95
95
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.
96
96
5\.6 Console.log the highest value.
97
-
97
+
---
98
98
6\.*Arrays!*
99
99
6\.1 Declare an empty array. Make sure that the name you choose indicates 'plurality', because an array is capable of containing more than one element. (See [Naming conventions](../fundamentals/naming_conventions.md).)
100
100
6\.2 Write a console.log statement that explains in words what you think the value of the array is.
@@ -103,13 +103,13 @@ Copy the code in your `.js` file and run it. You will see that you will get a Sy
103
103
6\.5 Log your array.
104
104
6\.6 Add a statement that adds Daan's favorite animal ('baby pig') to the *existing array*.
105
105
6\.7 Log your new array!
106
-
106
+
---
107
107
7\.*More strings*
108
108
7\.1 Let's consider the following string: `let myString = "this is a test"`.
109
109
7\.2 Add the string to your file and console.log it.
110
110
7\.3 Find a way to get the length of `myString`.
111
111
7\.4 Console.log the length of `myString`.
112
-
112
+
---
113
113
8\. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type.
114
114
8\.1 First declare at least four variables and assign them different data types.
115
115
8\.2 For each variable write a `console.log` statement that logs the value
@@ -136,7 +136,7 @@ if (...) {
136
136
}
137
137
// TODO -> add a way of giving feedback if your variables don't have the same type
138
138
```
139
-
139
+
---
140
140
9\. If `x` equals 7, and the only other statement is `x = x % 3`, what would be the new value of `x`?
141
141
9\.1 Add at least 3 `console.log` statements in which you show that you understand what `%` does.
0 commit comments