12/13 help


#1



I keep on getting an error message pop up saying that I have a syntax error : unexpected token {. Any thoughts?


var sleepCheck = function(numHours) 
{
    if(numHours>=8) {
        return "You're getting plenty of sleep! Maybe even too much!"
    }
    else(numHours<8) {
        return "Get some more shut eye!"
    }
    };
sleepCheck(10);
sleepCheck(5);
sleepCheck(8);


#2

Try putting the { on the same line:

var sleepCheck = function(numHours) {

#3

It still has the same error message pop up


#4

Try making that into else if (numHours < 8)


#5

Thanks a bunch man!!! I really appreciate the help


#6

var sleepCheck = function(numHours) <----- You're missing something at the end
{
if(numHours>=8) {
return "You're getting plenty of sleep! Maybe even too much!" <----- You're missing something at the end
}
else(numHours<8) <---- an else statements do not take any parameters, which means that there cannot be anything after else such as else { //your code goes here}
{
return "Get some more shut eye!" <----- You're missing something at the end
}
};
sleepCheck(10);
sleepCheck(5);
sleepCheck(8);


#7

There is nothing missing on the first line, and the semicolons that are missing don't matter because there is no code after it that would be affected.


#8

I entered this code for javascript and it said that "Susie is not defined".

var nameString = function(name) {
return "Hi, I am" + " " + name;
};
var newName = nameString(Susie);
console.log(newName);

I can't figure out what's wrong with the code and I've tried everything,

HELP


#9

Hi you should put " " around Susie, because now the function see it like a variable


#11

Never mind I took the advice you gave to mtracehenry. Thank you!!!!