Hi!
I am a little bit stuck on Sleep Dept Project and don’t really understand why it doesn’t work. I did watch walkthrough video, but, I guess my actual sleep dept doesn’t allow me to see problems with my JS Sleep Dept
When I am running the code, I am receiving an error “calculateSleepDept() is not defined”
const getSleepHours = day => {
switch(day){
case 'monday':
return 8;
case 'tuesday':
return 5;
case 'wednesday':
return 8;
case 'thursday':
return 7;
case 'friday':
return 8;
case 'saturday':
return 3;
case 'sunday':
return 9;
}
};
const getActualSleepHours = () => {
return getSleepHours('monday') +
getSleepHours('tuesday') +
getSleepHours('wednesday') +
getSleepHours('thursday') +
getSleepHours('friday') +
getSleepHours('saturday') +
getSleepHours('sunday');
};
const getIdealSleepHours = () => {
let idealHours = 9;
return idealHours * 7;
};
const calculateSleepDept = () => {
const actualSleepHours = getActualSleepHours();
const idealSleepHours = getIdealSleepHours();
if(actualSleepHours === idealSleepHours)
{
console.log('You got perfect amount of sleep!');
}
else if(actualSleepHours > idealSleepHours) {
console.log('You got ' + (actualSleepHours - idealSleepHours) + 'more hours of sleep than needed');
}
else if(actualSleepHours < idealSleepHours)
{
console.log('You got ' + (idealSleepHours - actualSleepHours) + ' less hour(s) than you are needed');
}
};
calculateSleepDebt();
Where did I make a mistake?
Would really appreciate your help!