sleepDebtCalculator - function undefined when calling

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();

The message suggests there is no such function. Your code should be inside a function body since it uses the return keyword.

const getIdealSleepHours = () => {	

const idealHours = 8*7;
console.log(idealHours);
};

The function should return a value rather than log it.

This function should return a value…

const getActualSleepHours = () => {
getSleepHours('monday') +
getSleepHours('tuesday') +
getSleepHours('wednesday') +
getSleepHours('thursday') +
getSleepHours('friday')
};

break after return is unreachable.

	case 'monday':
	return 8;
	break;

All the break keywords can and should be removed.

It appears you’ve accidentally enclosed all of your functions inside the getSleepHours function. I ran your code with the closing curly brace relocated to it’s proper place, and it functioned as expected.

CORRECTION: It runs, but the results are not correct as @mtf has pointed out.