List of Exercises # 5
1) Populate the below select box with the list of countries of the world. The task should be divided in two parts:
When a country is selected, use local storage to make it selected the next time the page is loaded.
2) The JSON below represents a list of courses. Each course has a title and an array of reviews. Create a function to parse the json, add another property for the average rating of each course, then return a new JSON with the updated object.
Use Try/Catch/Throw to comply with the following rules:
var courses = '[{"title": "PHP","reviews": []},{"title": "Javascript","reviews": [5,5,4.5,4,5,5,5,4.5]
},{"title": "Python","reviews": [5,5,4,4,5,3,5,4,4,5]},{"title": "Machine Learning",
"reviews": [5,5,4.5]}]';
3) Add a new functionality to the country selector of exercise # 1. When the country is selected list below it the public holidays for that country in the previous year. Use the layout below:
Country: Italy
Year: 2019
- 2019-01-01 - New Year's Day
- 2019-01-06 - Epiphany
- 2019-04-21 - Easter
- ...
To get the data about the holidays, use the Holiday API. You will need to sign up for a free API key.