12. Functions & if / else STUCK PLEASE HELP 12

var sleepCheck = function (numHours){

if (numHours >= 8) {

console.log(“You’re getting plenty of sleep! May be even too much!”);
}
else
{
console.log (“get some more shut eye!”);
}
};
console.log (sleepCheck(10));
console.log (sleepCheck(5));
console.log (sleepCheck(8));

Please help as I have no clue how to change it, sitting on it for last 2 h

Many thanks
A

Your message is slightly different from what they ask you to print.

Copy the two versions and put them on separate lines to compare them if not immediately obvious.
Copy the two versions and put them on separate lines to conpare them if not immediately obvious.

both of them do not work due to the same error

both of them are wrong

Both of which?
Make sure you’re using the correct string and if there are still errors we can go from there

at the moment I have code :slightly_smiling:
var sleepCheck = function (numHours);{

if (numHours >= 8) {
{

return"You’re getting plenty of sleep! May be even too much!";

}
else {
return"get some more shut eye!";

};
console.log (sleepCheck(10));
console.log (sleepCheck(5));
console.log (sleepCheck(8));

and I get the message that there is a problem with my syntax, just do not know where
I had tried to check semi- colons and} no success still

now , i have this:

var sleepCheck = function (numHours);{

if (numHours >= 8) {

return “You’re getting plenty of sleep! May be even too much!”;

}
else {
return “get some more shut eye!”;
}
};
console.log (sleepCheck(10));
console.log (sleepCheck(5));
console.log (sleepCheck(8));

the same problem ? with syntax ( Nothing prints on the console)

SyntaxError: Unexpected token.

? What are your suggestions?

var sleepCheck = function (numHours){;
if (numHours >= 8) {
return “You’re getting plenty of sleep! May be even too much!”;
}
else {
return “get some more shut eye!”;
}
};
console.log (sleepCheck(10));
console.log (sleepCheck(5));
console.log (sleepCheck(8));

I HAVE THIS CODE NOW, IT PRINTS BUT I CAN NO GO FUTHER:(((((( PLEASE HELP!!!

Fix the string so it matches what they ask for.

I do not understand , which string?
LINE 3 OR 6??

An easy way to find out is to just compare them.

i do compare them and DO NOT SEE THE DIFFERENCE

If you put the correct and incorrect versions each on their own lines like in my example above, it should be fairly easy to find.

You can also simply copy the correct one into your code.

Details matter when it comes to programming, so finding little differences is an important skill.

hi , after 3 h I got it right! Hurray

HELP!!!
what is wrong with this:
var sleepCheck = function (numHours){

if (numHours >= 8) {
return “You’re getting plenty of sleep! May be even too much!”;

}
else {
return “Get some more shut eye!”;
}

console.log (sleepCheck(10))
console.log (sleepCheck(5))
console.log (sleepCheck(8))

I was making the exact same mistake for over 3 hrs. @tarikjaber, check line 4 and make sure that the text matches the one they ask for. @ionatan Thanks. This really helped me.