What is wrong with my code?, it looks ok to me!, dumb mistake? Misspelling?


#1


https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/2/4?


Error: There was a problem with your syntax.


// 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!";
};

console.log(sleepCheck(10));


#2

function doesn't have a semi colon at the end rather a set of curly brackets and you run something in the function in this case the if/else statement..

so

var sleepCheck=function(numHours){

//run something in the function

}

#3

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