Need help with Sleep Debt Calculator

https://www.codecademy.com/paths/web-development/tracks/getting-started-with-javascript/modules/learn-javascript-functions/projects/sleep-debt-calculator

First of all, the walkthrough video only has 9 parts (when the excersice actualy has 12) and they are different :frowning:

Im working on part 9 :

Now that you have actualSleepHours and idealSleepHours , you can write a few if / else statements to output the result to the console. The function should fulfill this logic:

  • If actual sleep equals ideal sleep, log to the console that the user got the perfect amount of sleep.
  • If the actual sleep is greater than the ideal sleep, log to the console that the user got more sleep than needed.
  • If the actual sleep is less than the ideal sleep, log to the console that the user should get some rest.

my code:

const getSleepHours = day => {
  switch(day){
    case 'monday':
    return 8;
    break;
    case 'tuesday':
    return 7;
    break;
    case 'wednesday':
    return 8;
    break;
    case 'thursday':
    return 7;
    break;
    case 'friday':
    return 9;
    break;
    case 'saturday':
    return 10;
    break;
    case 'sunday':
    return 6;
    break;
  }
}

const getActualSleepHours = () =>  getSleepHours('monday') + getSleepHours('tuesday') + getSleepHours('wednesday') +  getSleepHours('thursday') + getSleepHours('friday') + getSleepHours('saturday') + getSleepHours('sunday'); 

const getIdealSleepHours = () => {
  idealHours = 8;
  return idealHours * 7;
};

const calculateSleepDebt = () => {
  const actualSleepHours = getActualSleepHours();
  const idealSleepHours = getIdealSleepHours();
  return actualSleepHours - idealSleepHours;
};

if (actualSleepHours === idealSleepHours) {
  console.log('great sleeping time');
} else if (actualSleepHours > idealSleepHours) {
  console.log('you are sleeping a lot bro');
} else {
  console.log('get more rest dude');
}

the error I got `/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/sleepDebtCalculator.js:39
if (actualSleepHours === idealSleepHours) {
^

ReferenceError: actualSleepHours is not defined
at Object. (/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/sleepDebtCalculator.js:39:5)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3`

I see you defined the variable, so then the next question is: Could it be a scope issue?

I found a solution on this comment.

The solution should be the secondary objective, its far more important to learn debugging and solving problems.