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

Skip to content

Commit 99e8434

Browse files
authored
Merge pull request HackYourFuture-CPH#91 from senner007/class09
add classwork exercises js week 7 class09
2 parents 71bacd3 + d656283 commit 99e8434

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Exercises
2+
3+
## Exercise 1
4+
5+
Imagine your are running a meal ordering website.
6+
Orders come in from the web and we need to store them in a json file.
7+
Create a json file with two orders that contain at least these things:
8+
9+
- Order name
10+
- Order id
11+
- Price
12+
- List of drinks
13+
- Order extras (fx cheese, lettuce etc.)
14+
15+
16+
## Exercise 2
17+
Use [this api](http://api.open-notify.org/astros.json) to fetch how many astronauts are currently in spaces.
18+
19+
```
20+
fetch('http://api.open-notify.org/astros.json')
21+
.then(response => response.json())
22+
.then((planets) => {
23+
console.log(planets);
24+
25+
// WRITE CODE HERE
26+
});
27+
```
28+
29+
`console.log` the following using the data you get from the api:
30+
31+
```
32+
There are NUMBER_OF_ASTRONAUTS astronauts in space, they are:
33+
ASTRONAUT_NAME1
34+
ASTRONAUT_NAME2
35+
ASTRONAUT_NAME3
36+
ASTRONAUT_NAME4
37+
ASTRONAUT_NAME5
38+
```
39+
40+
An example with 2 astronauts of this could be:
41+
42+
```
43+
There are 2 astronauts in space, they are:
44+
Benjamin Hughes
45+
Jørgen Pedersen
46+
```
47+
48+
## Exercise 3
49+
Using this api: https://thecatapi.com/
50+
https://api.thecatapi.com/v1/images/search?breed_ids=beng&api_key=YOUR_API_KEY
51+
1. Find some information about cats that have the breed siberian.
52+
2. Display 3 siberian cats.
53+
https://api.thecatapi.com/v1/images/search?breed_ids=beng
54+
55+
DONT DO THIS API AGAIN! Do one with no authentication.
56+
57+
## Exercise 4
58+
Using this API: https://dog.ceo/api/breeds/image/random
59+
60+
1. Get a random dog image and display it in the browser
61+
2. Get a new image every 2 sec.
62+
3. Get the list aogf all breeds from https://dog.ceo/api/breeds/list/all
63+
4. Display a random image of a breed from the list https://dog.ceo/api/breed/[BREEDNAME]/images/random
64+
5. Display the name of the breed under the image

0 commit comments

Comments
 (0)