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: javascript1/week1/homework.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,11 @@
9
9
10
10
This homework will get you started developing in javascript. What you learn the first 3 modules of javascript will be building blocks for creating great javascript web applications.
11
11
12
+
If you struggle to do this weeks homework there are a couple of things to do:
13
+
- Watch the class recording. If it for some reason is missing. Then watch these: [part 1](https://www.youtube.com/watch?v=uhTRC33cpp0), [part 2](https://www.youtube.com/watch?v=mVgyjr9MV5U)
14
+
- Read up on javascript basics [here](readme.md#variables)
15
+
16
+
12
17
## Step 2: Javascript warm up part one
13
18
Lets get started with some warm up exercises: On freeCodeCamp.com do the <ahref="https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript"target="_blank">Basic JavaScript</a> exercises up and until the **"Manipulate Arrays With push()"** exercise (there are some topics we did not cover but you can do it).
14
19
@@ -40,7 +45,7 @@ What type will these two variables be? Now calculate the age and store that in a
40
45
> The same friend (who by the way loves dogs) asks how old his dog will be in 2045. Hmm you think, lets make this into a product as well!
41
46
Dogs age can either be measured in dog years or in human years, this we want to take into consideration!
42
47
43
-
Like before lets create three variables but this time we call them dogYearOfBirth, dogYearFuture and dogYear. We add an extra variable called shouldShowResultInDogYears. If it is true we should show the result in dog years, if it is false we should show it in human years. What do we call this type of variable? Now log this string out:
48
+
Like before lets create three variables but this time we call them `dogYearOfBirth`, `dogYearFuture` and `dogYear`. We add an extra variable called `shouldShowResultInDogYears`. If it is `true` we should show the result in dog years, if it is false we should show it in human years. What do we call this type of variable? Now log this string out:
Copy file name to clipboardExpand all lines: javascript1/week2/homework.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,11 @@
3
3
## Why should i even do this homework?
4
4
Functions and conditions are some of the basic building blocks of javascript. Functions ensure that we dont repeat ourselves when writing code. Conditions ensures that we can handle different cases when programming.
5
5
6
+
If you struggle to do this weeks homework there are a couple of things to do:
7
+
- Watch the class recording. If it for some reason is missing. Then watch these: [part 1](https://www.youtube.com/watch?v=P9BQLgRm7zs), [part 2](https://www.youtube.com/watch?v=qFI5QnjN2GQ)
8
+
- Read up on javascript basics [here](readme.md#recap-logical-operators)
9
+
10
+
6
11
## Javascript warmup
7
12
Just like last homework, lets **warmup our brain**!
8
13
@@ -56,7 +61,7 @@ What do we do if `useFormalName` is not given as an argument?
56
61
57
62
Remember to consider someone calling the function with an empty string as firstname and lastname.
58
63
59
-
Try out your code by pasting your getFullname function in the javascript part of this codepen: https://codepen.io/hackyourfuture-cph/pen/jJWwbN
64
+
Try out your code by pasting your `getFullname` function in the javascript part of this codepen: https://codepen.io/hackyourfuture-cph/pen/jJWwbN
60
65
61
66
### Event application
62
67
Another customer has contacted us. He works for a secret company that rimes with foogle. The customer works on their calendar application. They need some functionality to help with writing what weekday an event is held.
Copy file name to clipboardExpand all lines: javascript1/week3/homework.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,10 @@ Array's has lots of helper functions, that is used all the time when developing
5
5
6
6
Objects can be used for **representing data** and it can **help structure your code**. An object can fx represent a user that has a firstname, surname, profile picture and a list of friends. It is constantly used in javascript and **essential to learning the language**.
7
7
8
+
If you struggle to do this weeks homework there are a couple of things to do:
9
+
- Watch the class recording. If it for some reason is missing. Then watch these: [part 1](https://www.youtube.com/watch?v=idfGCqAItGI), [part 2](https://www.youtube.com/watch?v=cNRFY0RW5L8)
10
+
- Read up on objects and arrays [here](readme.md#objects)
Copy file name to clipboardExpand all lines: javascript1/week4/homework.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,10 @@
3
3
## Why should i even do this homework?
4
4
Understanding the basics of Javascript is SUPER important. Therefore this homework focuses on repeating the basics to really have a solid understanding of this.
5
5
6
+
If you struggle to do this weeks homework there are a couple of things to do:
7
+
- Watch the class recording. If it for some reason is missing. Then watch these: [part 1](https://www.youtube.com/watch?v=Mo54btMPN7Q), [part 2](https://www.youtube.com/watch?v=mSUAoual5sE), [part 3](https://www.youtube.com/watch?v=uq3NnTtXqsU)
8
+
- Go through the last 3 weeks readme files. [Week 1](../week1/readme.md#variables), [week 2](../week2/readme.md#recap-logical-operators), [week 3](../week3/readme.md#objects)
Copy file name to clipboardExpand all lines: javascript2/week2/homework.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,16 @@ On top of that combining these array function with each other will show the func
7
7
8
8
The warmup exercises will be a bit abstract. But the in the **hyfBay exercise** the task will be a lot closer to a **real world task**.
9
9
10
+
## Appreciate how far you have come
11
+
Javascript is getting difficult now and we are aware of that! Take some time to appreciate how far you have come that last 6 weeks. Instead of comparing yourself to others, compare yourself to where you were a some time ago. If you are seeing progress then you are doing it right 💪
12
+
10
13
## Warmup array exercises
11
14
15
+
If you struggle to do this weeks homework there are a couple of things to do:
16
+
- Try watch this video: https://www.youtube.com/watch?v=Urwzk6ILvPQ
17
+
- Watch the class recording. If it for some reason is missing. Then watch these: [part 1](https://www.youtube.com/watch?v=AJt_O0EFDC8), [part 2](https://www.youtube.com/watch?v=4tj7CvD7ka8), [part 3](https://www.youtube.com/watch?v=CO40FG6pK2k)[part 4](https://www.youtube.com/watch?v=eA2tCs0AaaM)
18
+
- Read up on array functions [here](https://github.com/HackYourFuture-CPH/JavaScript/blob/master/javascript2/week2/readme.md#array-methods-map-filter-and-sort)
19
+
12
20
### Doubling of number
13
21
Say you would like to write a program that **doubles the odd numbers** in an array and **throws away the even number**.
14
22
@@ -38,10 +46,9 @@ Copy the movies array in the [movies](homework/movies.js) file. Use this array t
38
46
4. Create a new array that has an **extra key called tag**. The tag is based on the rating: Good (>= 7), Average (>= 4 and < 7), Bad (< 4)
39
47
5.**Using [chaining](readme.md#Chaining)**, first filter the movies array to only contain the movies rated higher than 6. Now map the movies array to only the rating of the movies.
40
48
6.**Count the total number of movies** containing any of following keywords: `Surfer`, `Alien` or `Benjamin`. So if there were 3 movies that contained `Surfer`, 1 with `Alien` and 2 with `Benjamin`, you would return 6. Can you make sure the search is case insensitive?
41
-
7. Create an array of movies where a **word in the title is duplicated**. Fx "Star **Wars**: The Clone **Wars**" the word **Wars** is duplicated.
42
-
8. Find the word that is **mostly duplicated** using [sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)*Optional*
43
-
9. Calculate the **average rating** of all the movies using [reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce). *Optional*
44
-
10.**Count the total number** of Good, Average and Bad movies using [reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce). *Optional*
49
+
7. Create an array of movies where a **word in the title is duplicated**. Fx "Star **Wars**: The Clone **Wars**" the word **Wars** is duplicated. Here are some madeup examples of movies with duplicated words in the title: "**The** three men and **the** pistol", "**Chase** three - The final **chase**"
50
+
8. Calculate the **average rating** of all the movies using [reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce). *Optional*
51
+
9.**Count the total number** of Good, Average and Bad movies using [reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce). A return could fx be `{goodMovies: 33, averageMovies: 45, goodMovies: 123}`*Optional*
45
52
46
53
47
54
## hyfBay - get the okay'est products here - continued
Copy file name to clipboardExpand all lines: javascript2/week3/homework.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,15 @@ We want you to realise that **functions are just variables** in javascript. It i
7
7
8
8
## Warmup
9
9
10
-
If you feel like you struggle with these exercises, try wathing this video: https://www.youtube.com/watch?v=Nau-iEEgEoM or watch the class recording from the class
10
+
If you struggle to do this weeks homework there are a couple of things to do:
11
+
- Try watch this video: https://www.youtube.com/watch?v=Nau-iEEgEoM
12
+
- Watch the class recording. If it for some reason is missing. Then watch these: [part 1](https://www.youtube.com/watch?v=57bGm2wa2JM), [part 2](https://www.youtube.com/watch?v=Rpvuz2ywiQM), [part 3](https://www.youtube.com/watch?v=bjvplXwTsyo)[part 4](https://www.youtube.com/watch?v=YE_off9euAc)
13
+
- Read up on functions, callback async and synchronous functions [here](readme.md#callbacks)
11
14
12
15
The warmup is a **little abstract**, it will get more concrete later on!
13
16
14
17
1. Log out the text `Called after 2.5 seconds` 2.5 seconds after the script is loaded.
15
18
16
-
17
19
2. Create a function that takes 2 parameters: `delay` and `stringToLog`. Calling this function should log out the `stringToLog` after `delay` seconds. Call the function you have created with some different arguments.
18
20

19
21
@@ -29,7 +31,6 @@ The warmup is a **little abstract**, it will get more concrete later on!
29
31
30
32

31
33
32
-
33
34
6.*Optional* Now show that location on a map using fx the [Google maps api](https://developers.google.com/maps/documentation/javascript/tutorial)
34
35
35
36
@@ -39,14 +40,12 @@ The warmup is a **little abstract**, it will get more concrete later on!
39
40
40
41
8. Check if we have double clicked on the page. A double click is defined by two clicks within 0.5 seconds. If a double click has been detected, log out the text: "double click!"
41
42
42
-
43
-
44
43
9. Create a function called `jokeCreator` that has three parameters: `shouldTellFunnyJoke` - boolean, `logFunnyJoke` - function and `logBadJoke` - function. If you set `tellFunnyJoke` to `true` it should call the `logFunnyJoke` function that should log out a funny joke. And vice versa.
45
44
46
45
### Function as a variable
47
46
Create funtions that are used in these different ways:
48
47
- Create an array with 3 items. All items should be functions. Iterate through the array and call all the functions.
49
-
- Create a function as a const and try creating a function normally. Call both functions.
48
+
- Create a function as a const and try creating a function normally. Call both functions. Read up on this if you are interested: https://stackoverflow.com/questions/1013385/what-is-the-difference-between-a-function-expression-vs-declaration-in-javascrip
50
49
- Create an object that has a key whose value is a function. Try calling this function.
51
50
52
51
Yes i know that was a little tough, now on to the fun part 🎉
Copy file name to clipboardExpand all lines: javascript2/week3/lesson-plan.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,9 @@ Good example of practical example of callbacks: https://github.com/HackYourFutur
37
37
38
38
At this point good coding practices is starting to get very important! Check our [coding best practices](https://github.com/HackYourFuture-CPH/curriculum/blob/master/review/review-checklist.md#javascript) and use these both when live coding but also in reviews.
Copy file name to clipboardExpand all lines: javascript3/week1/homework.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,11 @@ Working with json and api's is the way modern **javascript application's communi
5
5
6
6
It is how autocomplete can receive suggestions for a search query and how infinite scroll can keep loading new posts.
7
7
8
+
If you struggle to do this weeks homework there are a couple of things to do:
9
+
- Try watch these two videos: https://www.youtube.com/watch?v=uxf0--uiX0I, https://www.youtube.com/watch?v=tc8DU14qX6I
10
+
- Watch the class recording. If it for some reason is missing. Then watch these: [part 1](https://www.youtube.com/watch?v=0piVFh9S0Kc), [part 2](https://www.youtube.com/watch?v=DjdFsV1X9-o), [part 3](https://www.youtube.com/watch?v=5uN00cZzUKM)[part 4](https://www.youtube.com/watch?v=GB1N8XxFP7I)
11
+
- Read up on [fetch](https://javascript.info/fetch), [JSON](https://javascript.info/json). The articles are a little tricky
12
+
8
13
## Create your own json file
9
14
Create your own json file with something that **interests you**. Maybe that could be computers, pets, music etc.
Copy file name to clipboardExpand all lines: javascript3/week2/homework.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,13 @@ Promises creates a **pleasant way of working with asynchronous code**. It will m
5
5
6
6
Since promises is becoming standard in javascript, new browser api's use promises for interacting with them. `getUserMedia` for accessing webcam, `Navigator.getBattery()` for getting battery level, `Bluetooth.requestDevice()`, `serviceWorker` or `USB.requestDevice()`
7
7
8
+
If you struggle to do this weeks homework there are a couple of things to do:
9
+
- Try watch these two videos: https://www.youtube.com/watch?v=XO77Fib9tSI, https://www.youtube.com/watch?v=QO4NXhWo_NM
10
+
- Watch the class recording. If it for some reason is missing. Then watch these: [part 1](https://www.youtube.com/watch?v=SDr1FCqqjAs), [part 2](https://www.youtube.com/watch?v=V82nhqIYWP0), [part 3](https://www.youtube.com/watch?v=iQgYX5tB7gs)[part 4](https://www.youtube.com/watch?v=RYdLBdHZMCU)[part 5](https://www.youtube.com/watch?v=A41NxevmHwI)
11
+
- Read up on [promises](https://javascript.info/promise-basics), [async await](https://javascript.info/async-await)
8
12
9
13
### Movies exercise
10
-
This exercise is repetition of array functions. Dont use cahining or anything fancy. Just fetch the movies and use the correct array function to get the following movies:
14
+
This exercise is repetition of array functions. you dont have to use chaining or anything fancy. Just fetch the movies and use the correct array function to get the following movies:
11
15
12
16
Fetch movies from [this api](https://gist.githubusercontent.com/pankaj28843/08f397fcea7c760a99206bcb0ae8d0a4/raw/02d8bc9ec9a73e463b13c44df77a87255def5ab9/movies.json):
13
17
@@ -68,7 +72,7 @@ This task is about visually understanding the difference between Promise.all and
68
72
69
73
If you go into the [promise-visual homework folder](homework/promise-visual) there is some html, css and some js. If you clone down the javascript repo, then you can simply copy the files into your hyf-homework js3 week 2 folder. Dont modify move-element.js, only work in main.js!
70
74
71
-
There is a function available to you called `moveElement`. It moves an element to a new position and returns a promise. `moveElement` takes a `DOM element` and an `object` specifying the `x` and `y` of the new position. It then returns a `promise` that resolves after the `DOM element` has been moved.
75
+
There is a function available to you called `moveElement`. calling that function moves an element to a new position and returns a promise. `moveElement` takes a `DOM element` and an `object` specifying the `x` and `y` of the new position. It then returns a `promise` that resolves after the `DOM element` has been moved.
72
76
73
77
```js
74
78
// This code will move the li to the position 100, 100. Calling moveElement will return a promise that resolves after the li element has been moved.
-`translateOneByOne` - Should translate the circles one at a time from their **random start position** to their **target**. Log something out **after each element has been moved**
86
+
-`translateOneByOne` - Should translate the circles one at a time from their **random start position** to their **target** see the target positions below. Log something out **after each element has been moved**
85
87
-`translateAllAtOnce` - Should translate all the circles at the same time from their **random start position** to their **target**. Log out something **after all elements have been moved**
86
88
87
-
Test that the functions works as intended before submitting homework.
89
+
Test that the functions works as intended before submitting homework. You decide if you want to do it the promise way or the async/await way
0 commit comments