#12 Functions and if/else statements


#1

This is what i have:
// Write your function below.
// Don't forget to call your function!
var sleepCheck = function(numHours) {
if (hours asleep is >= 8)
{
console.log("You're getting plenty of sleep! Maybe even too much!");
}
else
{
console.log("you are not getting enogh sleep")
}
sleepCheck(10)
sleepCheck(5)
sleepCheck(8)
}

This is what it tells me to do:
Write a function named sleepCheck that takes the parameter numHours
Inside the function, write an if statement where if the number of hours of sleep is greater than or equal to 8, the computer will return "You're getting plenty of sleep! Maybe even too much!";.
Otherwise (else) if the number of hours of sleep is less than 8, have the computer return "Get some more shut eye!";
Then call the function with different hours of sleep

Call the function with 10 hours of sleep, like this: sleepCheck(10);
Call the function with 5 hours of sleep.
Call the function with 8 hours of sleep.

Please help.


#2

replace console.log's with return statement


#3

it says unexpected identifier


#4

please post your code


#5

// Write your function below.
// Don't forget to call your function!
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!";
}

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)
sleepcheck(5)
sleecheck(8)


#6

It is true that you can drop the curly brackets for else/if statements but you can't use a closing curly bracket and leave out the opening one

are you repeating this part by accident_