12 functions if/else


#1


Can someone help me, it does not return my sleepCheck(10) with any data.
below is my code:
var sleepCheck = function(numHours) {
if (numHours >= 8) {
return"You're getting plenty of sleep! Maybe even too much!";
}
else {
return"Get some more shut eye!"; } }
sleepCheck(10);
console.log(sleepCheck(5));
console.log(sleepCheck(8));


Replace this line with your code.


#2

HI try to put it inside a console.log() (sleepCheck(10))


#3

try this
var sleepCheck = function(numHours){
if(numHours >= 8 ){
return "You're getting plenty of sleep! Maybe even too much!";
}
else {
return "Get some more shut eye!";
}
};
sleepCheck(10);
console.log(sleepCheck(5));
console.log(sleepCheck(8));


#4

In the instructions it states to call the function and lists how to list it. When I put console.log it does show the hours for 10, but does not let me proceed to the next level - Below are the instructions.
Call the function with 10 hours of sleep, like this: sleepCheck(10);
When I use console.log it states this error:

Oops, try again.
It looks like sleepCheck() isn't returning "You're getting plenty of

sleep! Maybe even too much!" when numHours is 10. Check your if / else
syntax and whether you're using the correct comparison operator


#5

Isn't that how I currently have it?


#6

DId you add it like that ?

console.log(sleepCheck(10));

IF so Can you post your new code?


#7

I did:


#8

Try to refresh your the page.. if it doesn't work can you post your code?

TRy that

Remove the one space after the ..of sleep! so it should be

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

instead of

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

#9

The space was it!!! Thank you very much for your help!


#10

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