Hi! I’m having a little bit of trouble and I can’t figure out why.
So I’m currently taking care of the Sleep Debt calculator - https://www.codecademy.com/courses/introduction-to-javascript/projects/sleep-debt-calculator
and I can’t figure out why I’m getting this error.
In an attempt to get the sum of my sleep debt hours, I’m running the code:
const getActualSleepHours = () =>
getSleepHours(‘monday’) +
getSleepHours(‘tuesday’) +
getSleepHours(‘wednesday’) +
getSleepHours(‘thursday’) +
getSleepHours(‘friday’) +
getSleepHours(‘saturday’) +
getSleepHours(‘sunday’);
When I run this code, I get the right answer.
However, I thought with a zero parameter function you needed to include something along the lines of const getActualSleepHours = () => { (INSERT CONTENT HERE)
}. emphasis on the curly brackets When I run this code though, it prints “undefined”.
Later when I use another zero parameter function, I have to use the {…} or else I don’t get the right answer. I’m simply confused why in one instance I don’t need to use the curly brackets and it gives me the wrong answer, but when I use it later I have to use it or it doesn’t give me the right answer.
Anyone have any thoughts?