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: javascript2/week1/homework.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,21 +29,21 @@ This will create and checkout the branch so you are ready make commits to it
29
29
**Interacting with the DOM is a crucial part** of building a website. If we cannot interact with the DOM and the javascript we write cannot be used in a browser. **Connecting javascript to the browser opens up a new world of possibilities** where only the imagination is the limiting factor.
30
30
31
31
## Overview of homework
32
-
1.**Problem solving cardio:** Warmup exercise that includes
32
+
1.**[Problem solving cardio:](#1-problem-solving-cardio)** Warmup exercise that includes
33
33
- Find the shortest word
34
34
- Find and count the Danish letters
35
35
36
-
2. ⭐ **Spirit animal name generator:** Create an interactive page where the user can enter the name and receive a spirit animal name
36
+
2. ⭐ **[Spirit animal name generator:](#2-spirit-animal-name-generator)** Create an interactive page where the user can enter the name and receive a spirit animal name
37
37
38
-
3. 🌟 **hyfBay:** It's a single-page app where users can search for products. We will be building this website step by step over this course.
38
+
3. 🌟 **[hyfBay:](#hyfbay)** It's a single-page app where users can search for products. We will be building this website step by step over this course.
Let's create a page where **a user writes his name** in an input element. The user then clicks a button. The user will now **receive a spirit animal name**, fx Benjamin - The fullmoon wolf.
70
70
71
-
###Markup time!
71
+
##2.1. Markup time!
72
72
73
73
Create an input element, a button and a tag to display the spirit animal into.
74
74
75
-
###Setting up the events
75
+
##2.2. Setting up the events
76
76
77
77
When the user clicks the button, get the name the user wrote in the input field.
78
78
79
-
###Spirit animal part
79
+
##2.3. Spirit animal part
80
80
81
81
Now we can get the users name, next step is to **add the spirit animal string** and display that the users name, a dash and then the spirit animal. Fx Name: Peter: Peter - The crying butterfly
82
82
For creating the spirit animal create an array with 10 string representing spirit animals. Now get a random item in the array that will represent the spirit animal.
83
83
84
-
###New spirit animal
84
+
##2.4. New spirit animal
85
85
86
86
Now a user tells us that he wants a new spirit animal. No problem we say. Let's create functionality where a user can press a button and then get a new spirit animal.
87
87
88
-
###No input
88
+
##2.5. No input
89
89
90
90
What if the user clicks the generate new spirit animal and there is no text in the input?
91
91
92
-
###Event types - _Optional and a little tricky_
92
+
##2.6. Event types - _Optional and a little tricky_
93
93
94
94
Give the user the possibility to select **when the spirit animal should be created**. Should it be when the user clicks the button or when the user hovers the input field or when text is written in the input field?
95
95
@@ -99,25 +99,25 @@ An example is: A user select that she only wants to generate a spirit animal whe
#3. hyfBay - get the okay'est products here <aid='hyfbay'></a>
103
103
104
104
We have been **hired for a company** to do a SPA - Single Page App for them. It is a website where a user can search for products. The products can also be **filtered and sorted** based on what products the user wants to see.
105
105
106
106
We are going to be building this website step by step, so have patience :)
107
107
108
-
###Lets get started!
108
+
##3.1. Lets get started!
109
109
110
110
In the [homework/hyf-bay folder](homework/hyf-bay) there is a project template you should continue working on. So copy all the files into your `hyf-homework/javascript/javascript2/week1` folder.
111
111
112
112
The `index.html` is very basic. It simply loads two javascript files and include some css. The two javascript files are `hyfBayHelpers.js` and the `main.js`. `hyfBayHelpers.js` contains a function (`getAvailableProducts`) that we can use to get an array of products. In the `main.js` we will be writing all our code!
113
113
114
-
####Requirements
114
+
##3.2. Requirements
115
115
116
116
- Using the `getAvailableProducts` array we will render an html list of products
117
117
- The list should contain `title`, `price` and `rating`
118
118
- The list of products should be generated through calling a function called `renderProducts(products)`
119
119
120
-
####Example
120
+
### Example
121
121
122
122
```js
123
123
constproducts=getAvailableProducts();
@@ -131,7 +131,7 @@ renderProducts(products); // This should create the ul and the li's with the ind
131
131
132
132
So after calling the `renderProducts` function, the output should be like the output you can see here: https://codesandbox.io/s/hyf-bay-first-week-oml13
Copy file name to clipboardExpand all lines: javascript2/week2/homework.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,21 +37,21 @@ The warmup exercises will be a bit abstract. But the in the **hyfBay exercise**
37
37
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 💪
38
38
39
39
## Overview of homework
40
-
1.**Warmup array exercises:** Warmup exercise that includes
40
+
1.**[Warmup array exercises:](#1-warmup-array-exercises)** Warmup exercise that includes
41
41
- Doubling the number
42
42
- ⭐ Working with movies
43
43
44
-
2. 🌟 **hyfBay:** It's a single-page app where users can search for products.
44
+
2. 🌟 **[hyfBay](#hyfbay):** It's a single-page app where users can search for products.
45
45
46
-
##Warmup array exercises
46
+
#1. Warmup array exercises
47
47
48
48
If you struggle to do this weeks homework there are a couple of things to do:
49
49
50
50
- Try watch this video: https://www.youtube.com/watch?v=Urwzk6ILvPQ
51
51
- 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)
52
52
- Read up on array functions [here](https://github.com/HackYourFuture-CPH/JavaScript/blob/main/javascript2/week2/readme.md#array-methods-map-filter-and-sort)
53
53
54
-
###Doubling of number
54
+
##1.1. Doubling of number
55
55
56
56
Say you would like to write a program that **doubles the odd numbers** in an array and **throws away the even number**.
@@ -88,11 +88,11 @@ Copy the movies array in the [movies](homework/movies.js) file. Use this array t
88
88
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_
89
89
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_
90
90
91
-
## hyfBay - get the okay'est products here - continued
91
+
#2. hyfBay - get the okay'est products here - continued <aid='hyfbay'></a>
92
92
93
93
**Continue work on your homework regarding the Hyfbay** from previous week. Please copy the files from last week into this weeks `hyf-homework` folder and continue working there. If you have not made last weeks homework the solution for it is included in [this weeks homework folder](homework/hyf-bay) in the `main.js` file.
94
94
95
-
###Filter products
95
+
##2.1. Filter products
96
96
97
97
A very normal usecase for a product site is that a **user wants to search for some product** or find products that are cheaper than a set price. Lets implement that functionality for a user!
98
98
@@ -108,7 +108,7 @@ Lets get a little closer to javacript:
108
108
2.`.filter` on the products array
109
109
3.`renderProducts` with the filtered array
110
110
111
-
####Searching for products
111
+
##2.2 Searching for products
112
112
113
113
A user needs to search for products. That means that we need to add an input element to the html.
114
114
@@ -120,25 +120,25 @@ Use the overview shown above and the `renderProducts` function.
120
120
121
121

122
122
123
-
####Filter products based on max price
123
+
##2.3. Filter products based on max price
124
124
125
125
Lets help a user to find cheap products! When the **user writes a maximum price** the products should be filtered to match that maximum price
126
126
127
127
_Hint: Break this task into smaller tasks!_
128
128
129
129

130
130
131
-
####Make the website look nicer!
131
+
##2.4. Make the website look nicer!
132
132
133
133
The website looks awful now, **but** luckily you have had css and html and know exactly what it takes to make this website shine!
134
134
135
135
Improve it how you see fit. Maybe add a footer, header, logo, title, styling, responsivity. Whatever you feel like would improve the site!
136
136
137
-
###Create some extra feature
137
+
##2.5. Create some extra feature
138
138
139
139
No matter how small or how big. Create some feature that would be **cool/helpful/quirky/funny**.
140
140
141
-
###Sort the products - _optional_
141
+
##2.6 Sort the products - _optional_
142
142
143
143
This task is more open ended! So you need to come up with fx how the user should interact with the functionality.
Copy file name to clipboardExpand all lines: javascript2/week3/homework.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,18 +31,19 @@ Working with functions in javascript is such an essential part of working with j
31
31
We want you to realise that **functions are just variables** in javascript. It is exactly the same as string or a number. This homework forces you into using functions in weird ways that forces you to think differently about functions.
32
32
33
33
## Overview of homework
34
-
1.**Warmup:** Warmup exercise that includes
34
+
1.**[Warmup:](#1-warmup)** Warmup exercise that includes
35
35
- ⭐ Create a function to make delay in logging out text
36
36
- calling a function within a function
37
37
- ⭐ Log out location
38
38
- Implement runAfterDelay function
39
39
- Simulate double click with click event
40
40
- Implement joke creator
41
-
- ⭐ Function as a variable
42
41
43
-
2.🌟**The fastest presser in this realm:** It's a game where two people compete about who can press a key most often.
42
+
2.⭐**[Function as a variable:](#2-function-as-a-variable)**
44
43
45
-
## Warmup
44
+
3. 🌟 **[The fastest presser in this realm:](#3-the-fastest-presser-in-this-realm)** It's a game where two people compete about who can press a key most often.
45
+
46
+
# 1. Warmup
46
47
47
48
If you struggle to do this weeks homework there are a couple of things to do:
48
49
@@ -79,7 +80,7 @@ The warmup is a **little abstract**, it will get more concrete later on!
79
80
80
81
9. Create a function called `jokeCreator` that has three parameters: `shouldTellFunnyJoke` - boolean, `logFunnyJoke` - function and `logBadJoke` - function. If you set `shouldTellFunnyJoke` to `true` it should call the `logFunnyJoke` function that should log out a funny joke. And vice versa.
81
82
82
-
###Function as a variable
83
+
#2. Function as a variable
83
84
84
85
Create funtions that are used in these different ways:
85
86
@@ -91,7 +92,7 @@ Yes i know that was a little tough, now on to the fun part 🎉
@@ -111,7 +112,7 @@ You can implement it exactly like you want to, but here is my recommended order:
111
112
4.**Keep a counter** for how many times `l` and `s` was pressed.
112
113
5.**Now put it all together!** After the timeout is done figure out which of the counters is largest. Give some kind of feedback to the users indicating who won.
113
114
114
-
###Extra features
115
+
##2.1 Extra features
115
116
116
117
1.**Start a new game** functionality. Create some functionality so that the users can restart a game.
117
118
2. Try and give the site some **styling so it looks nice** :)
@@ -125,7 +126,7 @@ Here are some general things to consider:
125
126
- What if no time was specified for the game?
126
127
- What if there were no key presses before the game ends?
127
128
128
-
###Confetti
129
+
##3.3 Confetti
129
130
130
131
If you wanna give the game some confetti like in the gif, check out [this library](https://www.npmjs.com/package/confetti-js)
0 commit comments