const myWeekActivities = [
{ name: "Dev work for the man", hours: 40 },
{ name: "Fam", hours: 34 },
{ name: "Consulting for the cream", hours: 18 },
{ name: "Fishing", hours: 18 },
{ name: "Learning", hours: 12 },
]
const activityHours = activityName => myWeekActivities.find(
activity => activity.name === activityName
).hours
const enoughSleepPerDay = 7,
sleepPerDay = myWeekActivities.reduce(
(timeForSleep, activity) => timeForSleep - activity.hours, 168
) / 7,
officeTime = activityHours("Dev work for the man"),
clientTime = activityHours("Consulting for the cream"),
famTime = activityHours("Fam")
console.assert(sleepPerDay >= enoughSleepPerDay, "I don't sleep enough") //FAIL
console.assert(famTime > officeTime, "I see my co-workers more than my family") //FAIL
console.assert(famTime > clientTime, "I see my clients more than my family") //PASS