Hello!
I am very new to programming and have started with JavaScript, while working on a function’s project called ‘Sleep debt calculator’, whenever I call the function getActualSleepHours, I get NaN on the console, and I am unable to figure out why. Below is the code I wrote, please help me figure out the issue-
function getSleepHours(day){day=day.toLowerCase()
if(day===‘monday’){return 8;}
else if(day===‘tuesday’){return 9;}
else if(day===‘wednesday’){return 8;}
else if(day===‘thursday’){return 7;}
else if(day===‘friday’){return 8;}
else if(day===‘saturday’){return 9;}
else if(day===‘sunday’){return 10;}}
console.log(getSleepHours(‘sunday’));
function getActualSleepHours(){return getSleepHours(‘monday’) + getSleepHours(‘tuesday’) + getSleepHours(‘wednesdsay’) + getSleepHours(‘thursday’) + getSleepHours(‘friday’) + getSleepHours(‘saturday’) + getSleepHours(‘sunday’);}
console.log(getActualSleepHours());
Thanks!