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

Skip to content

Commit 6415aba

Browse files
committed
test homework week1
1 parent f25a05a commit 6415aba

File tree

2 files changed

+92
-19
lines changed

2 files changed

+92
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Here you can find course content and homework for the JavaScript 1,2 and 3 modul
99
|Week|Topic|Read|Homework|Review|
1010
|----|-----|----|--------|------|
1111
|0.|Preparation for your first JavaScript session|[Pre-reading](https://github.com/HackYourFuture/JavaScript/tree/master/Week0) + [CLI Reading Week 1](https://github.com/HackYourFuture/CommandLine/blob/master/Lecture-1.md)|-|
12-
|1.|[CLI](https://github.com/HackYourFuture/CommandLine) session with Unmesh :heart: <br>• Intro JavaScript (What is it, where can you use it for)<br>• Variables [var, let, const]<br>• Basic Data types [Strings, Numbers, Arrays]<br>• Operators|[Reading Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/README.md) | [Homework Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week1/REVIEW.md)|
12+
|1.|[CLI](https://github.com/HackYourFuture/CommandLine) session with Unmesh :heart: <br>• Intro JavaScript (What is it, where can you use it for)<br>• Variables [var, let, const]<br>• Basic Data types [Strings, Numbers, Arrays, Booleans]<br>• Operators|[Reading Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/README.md) | [Homework Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week1/REVIEW.md)|
1313
|2.|• Advanced data types [Objects] <br>• Conditions <br>• Statements vs Expressions<br> • Loops (for/while)<br>• Functions <br>• Naming conventions|[Reading Week 2](https://github.com/HackYourFuture/JavaScript/tree/master/Week2/README.md)|[Homework Week 2](https://github.com/HackYourFuture/JavaScript/tree/master/Week2/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week2/REVIEW.md)|
1414
|3.|[CLI](https://github.com/HackYourFuture/CommandLine) session with Unmesh :balloon: <br>• Closures <br>• Scope <br>• Array Manipulations <br>• Basic DOM manipulations [img src, innerHTML]<br>• Code commenting|[Reading Week 3](https://github.com/HackYourFuture/JavaScript/tree/master/Week3)|[Homework Week 3](https://github.com/HackYourFuture/JavaScript/tree/master/Week3/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week3/REVIEW.md)|
1515
|4.|• JSON<br>• Code debugging using the browser<br>• Functions + JSON/Arrays<br>• Code flow (order of execution) <br>• (capturing user input) <br>• Structuring code files|[Reading Week 4](https://github.com/HackYourFuture/JavaScript/tree/master/Week4)|[JS](https://github.com/HackYourFuture/JavaScript/tree/master/Week4/MAKEME.md) + [Git Homework Week 4](https://github.com/HackYourFuture/Git/blob/master/Lecture-1.md)|Review|

Week1/MAKEME.md

Lines changed: 91 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,106 @@ Write commands to do following:
3535

3636
## Step 2: JavaScript
3737

38-
> 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
38+
> 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.
3939
4040
1. Declare a variable `x` and initialize it with an integer.
41-
42-
2. How do you round the number 7.25, to the nearest integer?
43-
44-
3. Create a array called `colors` with the strings red, green and blue inside.
45-
46-
4. How can you find the length of the string you just created?
47-
48-
5. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type.
49-
For example:
41+
1.1 First, _declare_ your variable `x`.
42+
1.2 Add a console.log statement that explains what _you think_the value of `x` is, like in this example:
43+
```js
44+
// TODO -> here you initialize your variable
45+
console.log('the value of my variable x will be: whateverYouThinkItWillLog')
46+
```
47+
1.3 Add a console.log statement that logs the value of `x`
48+
1.4 Now _initialize_ your variable `x` with an integer
49+
1.5 Now add a console.log statement that explains what _you think_ the value of `x` is.
50+
1.6 Add a console.log statement that logs the value of `x`.
51+
Steps to be taken:
52+
53+
```js
54+
// TODO -> here you declare your variable
55+
console.log('the value of x will be: whateverYouThinkItWillLog')
56+
// TODO -> log the actual value of x
57+
// TODO -> here you initialize your variable
58+
console.log('the value of x will be: whateverYouThinkItWillLog')
59+
// TODO -> log value of x again
60+
```
61+
62+
2. Declare a variable `y` and assign a string to it.
63+
2.1 Write a console.log statement in which explain what you think the value of the string is
64+
2.2 Now console.log the variable `y`.
65+
2.3 Now assign a new string to the variable `y`
66+
2.4 Just like you did before write a console.log statement that explains what you think will be logged to the console.
67+
2.5 Now console.log `y` again.
68+
```js
69+
// TODO -> here you declare AND assign your string
70+
console.log('the value of my string will be: whateverYouThinkItWillLog')
71+
// TODO -> log the actual value of the string to the console
72+
// TODO -> assign a new value to your variable x
73+
console.log('the value of my string will be: whateverYouThinkItWillLog')
74+
// TODO -> log the actual value of the string to the console
75+
```
76+
77+
3. How do you round the number 7.25, to the nearest integer?
78+
3.1 Declare a variable `z` and assign the number 7.25 to it.
79+
3.2 Console.log `z`.
80+
3.3 Now round `z` to the nearest integer.
81+
3.4 Console.log `z` again.
82+
83+
4. Arrays!
84+
4.1 Declare an empty array (you can decide on how to call it yourself).
85+
4.2 Write a console.log statement in which explain what you think the value of the array is.
86+
4.3 Console.log your array.
87+
4.4 Create an array that has your favorite animals inside
88+
4.5 Log your array
89+
4.6 Ads Daan's favorite animal (baby pig) to the existing array
90+
4.7 Log your new array!
91+
4.8 Now add Gijs's favorite animal to the array (moose), but make sure it will be placed after the first animal that you have placed in your array.
92+
4.9 Write a console.log statement in which explain what _you think_ the new value of the array is.
93+
4.10 Log your new new array!
94+
4.11 Log the length of the array, add a message: "The array has a length of: "(here you should show the length of the array)
95+
4.12 Eyad does not like giraffes, delete this animal from the array
96+
4.13 Again log your new array.
97+
4.14 Now if unlike Gijs, you don't like mooses and you want to delete it from the array, but you don't know the position or the `index` of the item in the array, how can you find it?
98+
4.15 Log the index of moose to the console. Add a message so it says: "The item you are looking for is at index: " (here you should show the index of the item)
99+
100+
5. More strings
101+
5.1 Let's consider the following string: `let mystring = "this,is,a,test"`.
102+
5.2 Add the string to your file and console.log it.
103+
5.3 Find a way to get the length of `mystring`.
104+
5.4 Console.log the length of `mystring`.
105+
5.5 The comma's make that the sentence is quite hard to read. Find a way to remove the comma's from the sting and replace them with a spaces
106+
5.6 Console.log `mystring` to see if you succeeded.
107+
108+
109+
7. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type.
110+
6.1 First declare at least four variables and assign them with different data types.
111+
6.2 For each variable write a console log statement that that logs the value
112+
```js
113+
let foo = 3
114+
console.log('My the value of my variable foo is: ' + foo)
115+
```
116+
6.3 Now write a console.log statement weiring you first explain what you think the _type_ of your variables is.
117+
6.4 Now use `typeof` to log the actual _type_ of your variables.
118+
6.5 Now compare the types of your different variables with one another.
119+
6.6 Make sure to also show a message when the variables you are comparing are not the same type.
120+
For example:
50121
```js
51-
let x = 9;
52-
let y = 'Hello';
122+
let x = 9
123+
let y = 'Hello'
53124

54125
if () {
55-
console.log('SAME TYPE');
126+
console.log('SAME TYPE')
56127
}
57-
128+
// TODO -> add a way of giving feedback if your variables don't have the same type
58129
```
59130

60-
6. If `x` equals 7, and the only other statement is `x = x % 3`, what would be the new value of `x`?
131+
8. If `x` equals 7, and the only other statement is `x = x % 3`, what would be the new value of `x`?
132+
6.1 Add at least 3 `console.log` statements in which you show that you understand what `%` does.
61133

62-
7. Write a program to answer the following questions:
63-
* Can you store multiple types in an array? Numbers and strings?
64-
* Can you compare inifities? (Not in Eyad's world) - does 6/0 == 10/0? How can you test this?
134+
9. Write a program to answer the following questions:
135+
7.1 Can you store multiple types in an array? Numbers and strings?
136+
7.2 Can you compare inifities? (Not in Eyad's world) - does 6/0 == 10/0? How can you test this?
137+
7.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).
65138

66139
### Step 3: **Some freeCodeCamp challenges (10 hours):**
67140

0 commit comments

Comments
 (0)