Skip to content

Commit 8d81a33

Browse files
committed
Updated MAKEME with HYF Movies custom challenge
1 parent f6ae327 commit 8d81a33

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

Week4/MAKEME.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,26 @@
88
- https://www.freecodecamp.com/challenges/manipulating-complex-objects
99
- https://www.freecodecamp.com/challenges/convert-json-data-to-html
1010

11-
custom challenge:
12-
1. Go to http://www.omdbapi.com/?s=dog and change the word dog in the url to a different common word. You will get as a result, a list of movies with this word in the title. Make sure you get at least 5 results.
13-
2. You can copy the JSON and put it in a string at the top of your js file. Print the title of the 3rd movie in the array to the console.
14-
3. Make a ul with a li for each title (just like you did with the books in the previous assignment
15-
4. Use CSS to divide the page in two columns. The left column will have a list of the titles for each movie. The right column will have all the information listed for each movie.
16-
5. Replace the "Poster" property with the actual image of the poster. If you do this correctly, in the right column there will be a picture for each movie.
17-
6. Use the imdbID to create an URL to the IMDB page for that movie (hint: IMDB urls always look like this http://www.imdb.com/title/[imdbId] where [imdbId] would be replaced by the actual Id. If you do this correctly, each movie will have a link to its own IMDB page. Make sure the link opens in a new tab
18-
7. Make a Github Repository for your javascript homework. Store your solutions in this repo. Put the repo link in trello. NO MORE ZIP FILES :octocat:
11+
### Custom Challenge
12+
13+
In the HYF Movies Hands-On, we created the function `sortByImdbRating(movies)` to sort the list of movies by IMDB rating. Replace this function by a generalised version that takes the name of the property (`propName`) to sort on and a number `order` (allowed values 1 or -1, default value = 1) to indicate respectively ascending or descending sort order:
14+
15+
```js
16+
function sortMovies(movies, propName, order)
17+
```
18+
19+
Hint: remember from your high school math that:
20+
21+
- `1 x -1 = -1`, and
22+
- `-1 x -1 = 1`
23+
24+
Ensure that the new function produces the same results as the existing `sortByImdbRating` function when it is called like this:
25+
26+
```js
27+
movies = sortMovies(movies, 'imdbRating', -1);
28+
```
29+
30+
Notes:
31+
32+
1. Do not bother to make this work for the `Ratings` property which refers to an object rather than a simple value.
33+
2. It is not necessary to convert property values containing dates or numbers formatted with embedded commas to facilitate sorting for this challenge (but you're welcome to try). You can leave the value 'as is'.

0 commit comments

Comments
 (0)