Sleep debt calculator project in JavaScript

I am halfway through the sleep debt project and when I test my functions, the console prints:
5
NaN

Here is my code below:

const getSleepHours = day => {
  if (day === 'monday') {
    return 8;
  } else if (day === 'tuesday') {
    return 7;
  } else if (day === 'wednesday') {
    return 6;
  } else if (day === 'thursday') {
    return 5;
  } else if (day === 'friday') {
    return 9;
  } else if (day === 'saturday') {
    return 10;
  } else if (day ===  'sunday') {
    return 4;
  }
};

const getActualSleepHours = () =>
getSleepHours('Monday')
+ getSleepHours('Tuesday')
+ getSleepHours('Wednesday')
+ getSleepHours('Thursday')
+ getSleepHours('Friday')
+ getSleepHours('Saturday')
+ getSleepHours('Sunday');


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

console.log(getSleepHours('thursday'));
console.log(getActualSleepHours()); 

Any help would be appreciated :slight_smile:

Letter case matters. Strings must be identical in order to match.

Aside

Some would call this ‘case sensitive’ but they would be incorrect. JS is not case sensitive. It is not aware of letter case, only identity.

'Monday' === 'monday'   =>  false

So as I continue this project, I am getting a new error:

/home/ccuser/workspace/sleep-debt-calculator/sleepDebtCalculator.js:39
if (actualSleepHours === idealSleepHours) {
    ^

ReferenceError: actualSleepHours is not defined

Here is my almost finished code for the entire project (all I have left to do is to call the calculatSleepDebt function)

const getSleepHours = day => {
  if (day === 'Monday') {
    return 8;
  } else if (day === 'Tuesday') {
    return 7;
  } else if (day === 'Wednesday') {
    return 6;
  } else if (day === 'Thursday') {
    return 5;
  } else if (day === 'Friday') {
    return 9;
  } else if (day === 'Saturday') {
    return 10;
  } else if (day ===  'Sunday') {
    return 4;
  }
};

const getActualSleepHours = () =>
getSleepHours('Monday')
+ getSleepHours('Tuesday')
+ getSleepHours('Wednesday')
+ getSleepHours('Thursday')
+ getSleepHours('Friday')
+ getSleepHours('Saturday')
+ getSleepHours('Sunday');


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

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

if (actualSleepHours === idealSleepHours) {
  console.log('You got the perfect amount of sleep.');
  } else if (actualSleepHours > idealSleepHours) {
  console.log('You got more sleep than needed.');
  } else if (actualSleepHours < idealSleepHours) {
  console.log('You got ' + (idealSleepHours - actualSleepHours) + 'hour(s) less sleep than you needed this week. Get some rest.');
  } else {
  console.log('Error! Something went wrong');
  };

I appreciate the help.

That will happen if the variable is inside a function. It will not be defined in outer scope.