Functions Exercise 12


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!";
console.log (sleepCheck(10));
console.log (sleepCheck(5));
console.log (sleepCheck(8));

this is what i wrote and it's giving me an error and I don't know why


here u dont need to use console.log..its enough to use only sleepCheck(10);..u will be getting the answer


The console.logs are fine without them you'd only see the very last value. But what kind of error do you get? At first glance I'd say the code is ok maybe check your output messages and copy and paste them from the instruction if necessary.


same code same 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.


in 90% that means that you have a typo in your output message. But to confirm that you're not one of the 10% (made up numbers and vague estimates :smile:) better post your code so that one can have a look at it.


what actually solved it is deleting the other console.log statements.. tried with console.log (sleepCheck(10)); only... no more error/s... ^_^


Okaayyy... Well that is new :smile: As far as I know this has never been the problem.


This was the problem thanks man!