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

Skip to content

Commit a32cc01

Browse files
committed
Merge branch 'master' into improving-hyf-bay
2 parents 4cbcffc + 9badb0b commit a32cc01

File tree

11 files changed

+63
-19
lines changed

11 files changed

+63
-19
lines changed

javascript1/week1/homework.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
1010
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.
1111

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+
1217
## Step 2: Javascript warm up part one
1318
Lets get started with some warm up exercises: On freeCodeCamp.com do the <a href="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).
1419

@@ -40,7 +45,7 @@ What type will these two variables be? Now calculate the age and store that in a
4045
> 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!
4146
Dogs age can either be measured in dog years or in human years, this we want to take into consideration!
4247

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:
4449
"Your dog will be 10 human years old in 2027"
4550
or
4651
"Your dog will be 70 dog years old in 2027"

javascript1/week2/homework.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
## Why should i even do this homework?
44
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.
55

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+
611
## Javascript warmup
712
Just like last homework, lets **warmup our brain**!
813

@@ -56,7 +61,7 @@ What do we do if `useFormalName` is not given as an argument?
5661

5762
Remember to consider someone calling the function with an empty string as firstname and lastname.
5863

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
6065

6166
### Event application
6267
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.

javascript1/week3/homework.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Array's has lots of helper functions, that is used all the time when developing
55

66
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**.
77

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)
11+
812
## Javascript warmup
913

1014
Its warmup time!

javascript1/week4/homework.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
## Why should i even do this homework?
44
Understanding the basics of Javascript is SUPER important. Therefore this homework focuses on repeating the basics to really have a solid understanding of this.
55

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)
9+
610
## Finishing class exercises
711
Finish the exercises from the class
812

javascript2/week2/homework.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ On top of that combining these array function with each other will show the func
77

88
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**.
99

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+
1013
## Warmup array exercises
1114

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+
1220
### Doubling of number
1321
Say you would like to write a program that **doubles the odd numbers** in an array and **throws away the even number**.
1422

@@ -38,10 +46,9 @@ Copy the movies array in the [movies](homework/movies.js) file. Use this array t
3846
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)
3947
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.
4048
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*
4552

4653

4754
## hyfBay - get the okay'est products here - continued
94.7 KB
Loading

javascript2/week3/homework.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ We want you to realise that **functions are just variables** in javascript. It i
77

88
## Warmup
99

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)
1114

1215
The warmup is a **little abstract**, it will get more concrete later on!
1316

1417
1. Log out the text `Called after 2.5 seconds` 2.5 seconds after the script is loaded.
1518

16-
1719
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.
1820
![second task](assets/carbon.png)
1921

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

3032
![second task](assets/log-location.gif)
3133

32-
3334
6. *Optional* Now show that location on a map using fx the [Google maps api]( https://developers.google.com/maps/documentation/javascript/tutorial)
3435

3536

@@ -39,14 +40,12 @@ The warmup is a **little abstract**, it will get more concrete later on!
3940

4041
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!"
4142

42-
43-
4443
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.
4544

4645
### Function as a variable
4746
Create funtions that are used in these different ways:
4847
- 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
5049
- Create an object that has a key whose value is a function. Try calling this function.
5150

5251
Yes i know that was a little tough, now on to the fun part 🎉

javascript2/week3/lesson-plan.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ Good example of practical example of callbacks: https://github.com/HackYourFutur
3737

3838
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.
3939

40+
This is super good at explaining function logic
41+
![Function graphic](assest/../assets/function-graphic.jpg)
42+
4043
## Code inspiration
4144

4245
### Calling a function within a function

javascript3/week1/homework.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ Working with json and api's is the way modern **javascript application's communi
55

66
It is how autocomplete can receive suggestions for a search query and how infinite scroll can keep loading new posts.
77

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+
813
## Create your own json file
914
Create your own json file with something that **interests you**. Maybe that could be computers, pets, music etc.
1015

javascript3/week2/homework.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ Promises creates a **pleasant way of working with asynchronous code**. It will m
55

66
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()`
77

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)
812

913
### 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:
1115

1216
Fetch movies from [this api](https://gist.githubusercontent.com/pankaj28843/08f397fcea7c760a99206bcb0ae8d0a4/raw/02d8bc9ec9a73e463b13c44df77a87255def5ab9/movies.json):
1317

@@ -68,7 +72,7 @@ This task is about visually understanding the difference between Promise.all and
6872

6973
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!
7074

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.
7276

7377
```js
7478
// 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.
@@ -78,13 +82,13 @@ moveElement(document.querySelector('li'), {x: 100, y: 100})
7882
});
7983
```
8084

81-
82-
8385
Your task is to create two functions.
84-
- `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**
8587
- `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**
8688

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
90+
91+
### Target positions:
8892

8993
```
9094
Red circle target: x: 20px, y: 300px;

0 commit comments

Comments
 (0)