Struggling to complete this sleepDebtCalculator project
I’m struggling with this project, I was so close to thinking i had it complete until calling the final function - calculateSleepDebt();
i see an error: calculateSleepDebt(); is not defined
Except that function is defined in my code. I’m sure this must be a simple fix but i just don’t see it, its driving me mad.
my entire code is this:
const getSleepHours = day => {
switch(day){
case 'monday':
return 8;
break;
case 'tueday':
return 7;
break;
case 'wednesday':
return 8;
break;
case 'thursday':
return 6;
break;
case 'friday':
return 8;
break;
case 'saturday':
return 8;
break;
case 'sunday':
return 7;
break;
};
const getActualSleepHours = () => {
getSleepHours('monday') +
getSleepHours('tuesday') +
getSleepHours('wednesday') +
getSleepHours('thursday') +
getSleepHours('friday')
};
const getIdealSleepHours = () => {
const idealHours = 8*7;
console.log(idealHours);
};
const calculateSleepDebt = () => {
const actualSleepHours = getActualSleepHours();
const idealSleepHours = getIdealSleepHours();
if (actualSleepHours === idealSleepHours) {
console.log( 'you have had the perfect amount of sleep');
} else if (actualSleepHours > idealSleepHours) {
console.log ('You got more sleep than needed');
} else if (actualSleepHours < idealSleepHours){
console.log('You need more sleep!!');
}
};
}
calculateSleepDebt();