Hi there,
I’m completely stuck on the Sleep Debt problem. I even followed the course instructors code exactly and it’s still not working! Can anyone please take a look at my code and tell me what is wrong with it?
const getSleepHours = day => {
if(day === “Monday”) {
console.log(8);
} if
(day === “Tuesday”) {
console.log(6);
} if
(day === “Wednesday”) {
console.log(7);
} if
(day === “Thursday”) {
console.log(7);
} if
(day === “Friday”) {
console.log(7);
} if
(day === “Saturday”) {
console.log(9);
} if
(day === “Sunday”) {
console.log(7);
}
};
const getActualSleepHours = () =>
getSleepHours(“Monday”) +
getSleepHours(“Tuesday”) +
getSleepHours(“Wednesday”) + getSleepHours(“Thursday”) +
getSleepHours(“Friday”) +
getSleepHours(“Saturday”) +
getSleepHours(“Sunday”);
console.log(getSleepHours(“Monday”));
console.log(getActualSleepHours());
I’ve tested the getSleepHours function and that works fine but when I console.log the getActualSleepHours, I keep on getting NaN. So confused because I’ve even ended up copying the tutorial video code exactly and it’s still doing it!
Thanks so much in advance.