Here is the code above. On running it in console, an extra ‘undefined’ string below the actual log appears. There is something wrong, but I can’t figure out. Help me, please.
Hello! This is due to the fact there are no
return statements in the
calculateSleepDebt function. When you log this function at the end, it is called-so all of the
console.log()s are printed, and, since there is no
return, the default
return value from a function is
undefined, so that is what you are printing when you do
I hope this helps!
Thanks for the help I got it.