|
1 | 1 | ## Homework week 1:
|
2 | 2 |
|
3 |
| ->[Here](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/README.md) you find the readings you have to complete before the second lecture. |
4 |
| -
|
5 |
| -## Before you start with the homework: |
6 |
| - |
7 |
| -1. Go through the review of [week 1](https://github.com/HackYourFuture/JavaScript/blob/master/Week1/REVIEW.md) |
8 |
| -2. Watch: [What is programming](https://www.khanacademy.org/computing/computer-programming/programming/intro-to-programming/v/programming-intro) Just watch the 2 min video, you do not have to do the entire JavaScript course (It could be useful later on though). |
9 |
| -3. Please watch the following parts of the course, [Programming Foundations Fundamentals](https://www.lynda.com/Programming-Foundations-tutorials/Welcome/83603/90426-4.html) on Lynda.com (if you don't have access to Lynda yet ask Gijs): |
10 |
| - 0. Introduction |
11 |
| - 1. Programming Basics |
12 |
| - 2. Core Programming Syntax |
13 |
| - 3. Variables and Data Types |
14 |
| - |
15 |
| - |
16 |
| -## Step 2: Feedback |
17 |
| - |
18 |
| -_Deadline Wednesday_ |
| 3 | +``` |
| 4 | +Topics discussed in class this week: |
| 5 | +• Git |
| 6 | +``` |
19 | 7 |
|
20 |
| -Provide feedback on the HTML-CSS assignments (week 3) of one of your fellow students. You will be assigned to one of the assignments by the class lead of this week. |
| 8 | +>[Here](/Week1/README.md) you find the readings you have to complete before the fifth lecture. |
21 | 9 |
|
22 |
| -## Step 3: JavaScript |
| 10 | +## Step 1: Share a useful resource |
23 | 11 |
|
24 |
| -_Deadline Thursday_ |
| 12 | +_Deadline Monday_ |
25 | 13 |
|
26 |
| -> 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 |
| 14 | +All share a video or a resource (this can be a drawing, article or a pod cast) that was helpful for you the last few weeks with learning JavaScript. Please share this in the channel of your class in Slack. Also write as small note about what the resource i about and why you think it's so helpful (you can share more than one if you like). |
27 | 15 |
|
28 |
| -1. Write a `console.log` statement saying "Hello World!" for each language that you know. |
| 16 | +## Step 2: Feedback |
29 | 17 |
|
30 |
| -For example: |
31 |
| -``` |
32 |
| -Halo, dunia! // Indonesian |
33 |
| -Ciao, mondo! // Italian |
34 |
| -Hola, mundo! // Spanish |
35 |
| -``` |
| 18 | +_Deadline Monday_ |
36 | 19 |
|
37 |
| -2. Consider the following code: |
38 |
| -``` |
39 |
| -console.log('I'm awesome'); |
40 |
| -``` |
41 |
| -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. |
42 |
| - |
43 |
| -3. Declare a variable `x` and initialize it with an integer. |
44 |
| - 3.1 First, _declare_ your variable `x`. |
45 |
| -<br> 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: |
46 |
| - ```js |
47 |
| - // TODO -> here you initialize your variable |
48 |
| - console.log('the value of my variable x will be: whateverYouThinkItWillLog'); |
49 |
| - ``` |
50 |
| -<br> 3.3 Add a console.log statement that logs the value of `x` |
51 |
| -<br> 3.4 Now _initialize_ your variable `x` with an integer |
52 |
| -<br> 3.5 Now add a console.log statement that explains what _you think_ the value of `x` is. |
53 |
| -<br> 3.6 Add a console.log statement that logs the value of `x`. |
54 |
| - Steps to be taken: |
55 |
| - |
56 |
| - ```js |
57 |
| - // TODO -> here you declare your variable |
58 |
| - console.log('the value of x will be: whateverYouThinkItWillLog'); |
59 |
| - // TODO -> log the actual value of x |
60 |
| - // TODO -> here you initialize your variable |
61 |
| - console.log('the value of x will be: whateverYouThinkItWillLog'); |
62 |
| - // TODO -> log value of x again |
63 |
| - ``` |
64 |
| - |
65 |
| -4. Declare a variable `y` and assign a string to it. |
66 |
| - 4.1 Write a console.log statement in which you explain in words what _you think_ the value of the string is |
67 |
| -<br> 4.2 Now console.log the variable `y`. |
68 |
| -<br> 4.3 Now assign a new string to the variable `y` |
69 |
| -<br> 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. |
70 |
| -<br> 4.5 Now console.log `y` again. |
71 |
| - ```js |
72 |
| - // TODO -> here you declare AND assign your string |
73 |
| - console.log('the value of my string will be: whateverYouThinkItWillLog'); |
74 |
| - // TODO -> log the actual value of the string to the console |
75 |
| - // TODO -> assign a new value to your variable x |
76 |
| - console.log('the value of my string will be: whateverYouThinkItWillLog'); |
77 |
| - // TODO -> log the actual value of the string to the console |
78 |
| - ``` |
79 |
| - |
80 |
| -5. How do you round the number 7.25, to the nearest integer? |
81 |
| - 5.1 Declare a variable `z` and assign the number 7.25 to it. |
82 |
| -<br> 5.2 Console.log `z`. |
83 |
| -<br> 5.3 Declare another variable `a` that has the value of z but rounded to the nearest integer. |
84 |
| -<br> 5.4 Console.log `a` |
85 |
| -<br> 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. |
86 |
| -<br> 5.6 Console.log the highest value. |
87 |
| - |
88 |
| -6. Arrays! |
89 |
| - 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). |
90 |
| -<br> 6.2 Write a console.log statement that explains in words what you think the value of the array is. |
91 |
| -<br> 6.3 Console.log your array. |
92 |
| -<br> 6.4 Create an array that has your favorite animals inside |
93 |
| -<br> 6.5 Log your array |
94 |
| -<br> 6.6 Add a statement that adds Daan's favorite animal (baby pig) to the *existing array* |
95 |
| - |
96 |
| -<br> 6.7 Log your new array! |
97 |
| - |
98 |
| -7. More strings |
99 |
| -<br> 7.1 Let's consider the following string: `let myString = "this,is,a,test"`. |
100 |
| -<br> 7.2 Add the string to your file and console.log it. |
101 |
| -<br> 7.3 Find a way to get the length of `myString`. |
102 |
| -<br> 7.4 Console.log the length of `myString`. |
103 |
| - |
104 |
| -8. Write a program that checks the types of two variables and prints out `SAME TYPE` if they are the same type. |
105 |
| - 8.1 First declare at least four variables and assign them different data types. |
106 |
| -<br> 8.2 For each variable write a `console.log` statement that logs the value |
107 |
| - ```js |
108 |
| - let foo = 3; |
109 |
| - console.log('The value of my variable foo is: ' + foo); |
110 |
| - ``` |
111 |
| -<br> 8.3 Now write a console.log statement wherein you first explain in words what you think the _type_ of your variables is. |
112 |
| -<br> 8.4 Now use `typeof` to log the actual _type_ of your variables. |
113 |
| -<br> 8.5 Now compare the types of your different variables with one another. |
114 |
| -<br> 8.6 Make sure to also show a message when the variables you are comparing are not the same type. |
115 |
| -<br> For example: |
116 |
| - |
117 |
| -```js |
118 |
| -let x = 9; |
119 |
| -let y = 'Hello'; |
120 |
| - |
121 |
| -if () { |
122 |
| - console.log('SAME TYPE'); |
123 |
| -} |
124 |
| -// TODO -> add a way of giving feedback if your variables don't have the same type |
125 |
| -``` |
| 20 | +Give one of your fellow students in Github feedback about their homework of the previous week: create an issue in their repo, telling them what they did great and what they can improve. |
126 | 21 |
|
127 |
| -9. If `x` equals 7, and the only other statement is `x = x % 3`, what would be the new value of `x`? |
128 |
| - 9.1 Add at least 3 `console.log` statements in which you show that you understand what `%` does. |
| 22 | +Step3 |
129 | 23 |
|
130 |
| -10. Write a program to answer the following questions: |
131 |
| - 10.1 Can you store multiple types in an array? Numbers and strings? Make an example that illustrates your answer. |
132 |
| -<br> 10.2 Can you compare infinities? (Not in Eyad's world) - does 6/0 === 10/0? How can you test this? |
133 |
| -<br> 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). |
| 24 | +## Step 3: Git homework |
134 | 25 |
|
135 |
| -### Step 4: **Some freeCodeCamp challenges (10 hours):** |
| 26 | +_Deadline Wednesday_ |
136 | 27 |
|
137 |
| -Deadline Saturday_ |
| 28 | +Git homework for this week: |
138 | 29 |
|
139 |
| -On freeCodeCamp.com please do the [Basic JavaScript](https://www.freecodecamp.com/challenges/learn-how-free-code-camp-works) exercises up and until the __"Shopping List"__ exercise (there are some topics we did not cover but you can do it). |
| 30 | +Pair up with another student in your class. The homework requires two people to work together. Let us call them admin and user. |
140 | 31 |
|
141 |
| -### How to hand in Homework: |
142 |
| -``` |
143 |
| -steps: |
144 |
| -• Create a Github account |
145 |
| -• Create a new repository (name it something like hyf-javascript1) make sure you select the option: initialize with README |
146 |
| -• inside this repository create a folder "week1" |
147 |
| -• Upload the files you created on your computer inside the week1 folder, write a description for this “commit” |
148 |
| -• Open the file in your README to check if this all worked |
149 |
| -
|
150 |
| -• Create a new repository "hyf-javascript1". Also create a new folder "week1" inside this repository. |
151 |
| -• Upload your homework files inside the week1 folder and write a description for this “commit”. |
152 |
| -• Your hyf-javascript1/week1 should now contain all your homework files. |
153 |
| -• Place the link to your repository folder in Trello. |
154 |
| -``` |
| 32 | +1. admin creates a new repository on github called “animals” (without quotes). |
| 33 | +2. admin adds a file called “zoo.txt” with some animal generally found in a zoo. |
| 34 | +3. admin commits and pushes his changes (in master branch) |
| 35 | +4. admin adds user as a collaborator (find out how to add a collaborator to a git repository) |
| 36 | +5. user clones a repository from admin (find out how to clone a repository. Note that `git init` is not required when you clone a repository) |
| 37 | +6. user makes a new branch called user-dev |
| 38 | +7. user adds another file called “pets.txt” with some animals generally found in a home. |
| 39 | +8. user commits and pushes his branch to remote |
| 40 | +9. admin pulls the branch crated by user (find out how to pull changes from the repository) |
| 41 | +10. admin submits the link to his github repository (named animal), where unmesh should be able to see the collaborator’s (i.e. user’s) branch along with his commits. |
155 | 42 |
|
156 |
| -### Hint |
157 |
| -If you solve the FreeCodeCamp challenges and they are new concepts to you and you would like to take a look at them later on in the program, Copy your answers from FCC in a `.js` file and upload them to Github in a repository for future reference. In this way you build your own little documentation, if you look back at them first try to understand what it does before you run them. |
| 43 | +Note: |
158 | 44 |
|
159 |
| -:star: Additional resources and review: [here](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/REVIEW.md) (work in progress):star: |
| 45 | +The *user* is *not supposed to fork* the admin’s repository. *admin* is supposed to add user as a collaborator and *user* should just *clone* the repository (i.e. *user* will only have the local copy of the repository). Only *admin* will have the *github* server copy of the repository. Of course, admin will have its local copy of the repository too. |
160 | 46 |
|
0 commit comments