Hello,
I’ve got a syntax error “SyntaxError: Unexpected identifier” for project: https://www.codecademy.com/courses/introduction-to-javascript/projects/sleep-debt-calculator
I starts from the if statement : if (actualSleepHours === idealSleepHours)
I’m not sure why? If anybody can help me.
Muchos gracias in advance!
const getSleepHours = day => {
if (day === 'Monday') {
return 8;
}
else if (day === 'Tuesday') {
return 7;
}
else if (day === 'Wednesday') {
return 7;
}
else if (day === 'Thursday') {
return 7;
}
else if (day === 'Friday') {
return 9;
}
else if (day === 'Saterday') {
return 7;
}
else if (day === 'Sunday') {
return 7;
}
else {
}
};
const getActualSleepHours = () =>
getSleepHours('Monday') +
getSleepHours('Tuesday') +
getSleepHours('Wednesday') +
getSleepHours('Thursday') +
getSleepHours('Friday') +
getSleepHours('Saterday') +
getSleepHours('Sunday');
const getIdealSleepHours = () => {
let 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 ' + (idealSleepHours - actualSleepHours) + ' hour(s) less sleep than you need this week. Get some rest')
}
else if (actualSleepHours > idealSleepHours) {
console.log('You got ' + (idealSleepHours-actualSleepHours) + ' more sleep than needed')
}
else {
console.log ('Error!')
}
}
calculateSleepDebt ();