Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 
avatar of BlueWater86

BlueWater86

BlueWater86 has asked 1 questions and find answers to 6 problems.

Stats

135
EtPoint
38
Vote count
1
questions
6
answers

About

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