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…