w_5_1 HOF
This commit is contained in:
39
w5_1_HOF/index.js
Normal file
39
w5_1_HOF/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import data from './data.js';
|
||||
import dataJSON from './data.js'; // this file is a module so we can import
|
||||
console.log(dataJSON);
|
||||
|
||||
// 1. Get the list of people with age > 21. How many are there?
|
||||
const over21 = undefined;
|
||||
// setAnswer(1, over21);
|
||||
|
||||
// 2. Add a universal basic income of 100 but 500 to Andrea
|
||||
const updatedData = undefined;
|
||||
|
||||
// 3. Get the total and average income for the entire population.
|
||||
const totIncome = undefined;
|
||||
const avgIncome = undefined;
|
||||
// setAnswer(2, `Tot income: ${totIncome}, Average income: ${avgIncome}`);
|
||||
|
||||
// 4. Get total and average income of people older than 21 (included).
|
||||
const totIncome21 = undefined;
|
||||
const avgIncome21 = undefined;
|
||||
// setAnswer(3, `Tot income: ${totIncome21}, Average income: ${avgIncome21}`);
|
||||
|
||||
// 5. Find in which city “Mitsue Tollner” lives.
|
||||
const city = undefined;
|
||||
// setAnswer(4, city);
|
||||
|
||||
// 6. Find if there is anyone who lives in the same city of others.
|
||||
const sameCities = undefined;
|
||||
// setAnswer(5, sameCities);
|
||||
|
||||
// 7. Get the city/cities where most people live.
|
||||
const mostPopularCity = undefined;
|
||||
// setAnswer(6, mostPopularCity);
|
||||
|
||||
function setAnswer(n, content) {
|
||||
if (n < 0 || n > 7) return;
|
||||
const el = document.getElementById(`q${n}`);
|
||||
el.innerHTML = content;
|
||||
el.style.color = 'green';
|
||||
}
|
||||
Reference in New Issue
Block a user