Functions & if / else


#1

Can someone tell me whats wrong with my code ?? All it says is that their's a: SyntaxError: Unexpected token if
// Write your function below.
// Don't forget to call your function!
var sleepCheck = function(numHours)
if(numHours >= 6) {
return "You're getting plenty of sleep! Maybe even too much!";
}
else {
return "Get some more shut eye!";
}
console.log(sleepCheck(5));
console.log(sleepCheck(6));
console.log(sleepCheck(8));


#2

general function syntax:

var functionName = function(parameter){
  // do something
}

the curly brackets are missing in your case


#3

Thank you soo much :slight_smile: it was such a simple mistake