I need help with this lesson on Javascript functions


Intro to functions in JavaScript, Lesson 12

I have some issues with this code. Whenever I submit this code into the system it returns "[Function: sleepCheck]" which is in no way what I intend to do. For some odd reason the codecademy system says I am doing it right and passes me to the next lesson. Please help me figure out why this wont work.

var sleepCheck = function(numHours)
 if (numhours(6) > 8)  
   return "You're getting plenty of sleep! Maybe even too much!";
   return("Get some more shut eye!");


Note the parameter in the above. numHours. That is the variable to use in the function.

The (6) should be removed from the condition above, and tacked onto the function call...

numHours > 8



Return don't put "()"

Tis is good
return "You're getting plenty of sleep! Maybe even too much!";

This is bad
return("Get some more shut eye!");



I did that and still does not seem to work. can you give me an example of the full code so I may see how the entire code should look.


Show us your corrected code, please. Thanks.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.