Need Help with sleep debt calculator

Hey ladies n gents <3
I’m new to coding, and stuck on this project and can’t seem to see what I’m doing wrong… can someone help please?
Here’s my code so far…

const getSleepHours = (day) => {

if(day === ‘Monday’) {

return 8;

} else if (day === ‘Tuesday’) {

return 8;

} else if (day === ‘Wednesday’) {

return 7;

} else if (day === ‘Thursday’) {

return 6;

} else if (day === ‘Friday’) {

return 9;

} else if (day === ‘Saturday’) {

return 9;

} else if (day === ‘Sunday’) {

return 8;

} else {

}

}

const getActualSleepHours = () =>

getSleepHours(‘Monday’) +

getSleepHours(‘Tuesday’) +

getSleepHours(‘Wednesday’) +

getSleepHours(‘Thursday’) +

getSleepHours(‘Friday’) +

getSleepHours(‘Saturday’) +

getSleepHours(‘Sunday’);

const getIdealSleepHours = () => {

let idealHours = 8;

return idealHours * 7

}

const calculateSleepDebt = () => {

const actualSleepHours = getActualSleepHours();

const idealSleepHours = getIdealSleepHours();

and I keep getting this error

const getSleepHours = (day) => {
if(day === ‘Monday’) {
return 8;
} else if (day === ‘Tuesday’) {
return 8;
} else if (day === ‘Wednesday’) {
return 7;
} else if (day === ‘Thursday’) {
return 6;
} else if (day === ‘Friday’) {
…let idealHours = 8;
return idealHours * 7
}

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

Output-only Terminal
Output:
/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/sleepDebtCalculator.js:2
if(day === ‘Monday’) {
^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
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)

What am I doing wrong? Completely brand new to coding btw…

Have you rushed through the basic introduction, btw? If you don’t stop to practice nothing will stick. Early on we are taught about debugging our code and being able to find our mistakes, typos, missing brackets, and other syntax errors. I’d start looking for missing brackets.

I would recommend going through this article, it will help you better help us understand what your problems are. She gives examples of formatting your code in the post and links to an article specifically about how to format your code in posts so that it is easy to read and debug. How to ask good questions (and get good answers)

and to build on what mtf said, when I first started, and even sometimes now, a pesky semicolon or a bracket were the bane of my existence. Scope issues and typos tend to be like 90% of the reasons why my code doesn’t run properly. when I say scope issues I mean a misplaced bracket so that the function or variable etc is not within the proper scope in order to be understood/read/written to. Now in JS semicolons don’t matter much, but as you move to other languages they really will.

try going through the articles mtf and I linked, reformat your post, and then we can go from there.

Hi jamotogeek,

The errors you’re getting are syntax errors, meaning you’re missing somethings in how you’ve written your code. Based on what you provided, I can see your getActualSleepHours function syntax is wrong (missing opening and closing curly brackets in your function declaration before declaring your getIdealSleepHours function) As previous responders have advised, I’ll join to say look at your function syntaxes again. In the error message you got, you would usually see the line on which the error occurred (I think it’s at the end of the second line).