If/else statement inside of function


#1

https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661#


IM STUCK. I feel my semicolons and brackets are in the right place but apparently not.


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)


#2

Just missing the closing brace on your function.


#3

where? i keep seeing that on other posts. WHERE exactly is that supposed to go?


#4

This needs to look like this.

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

#5

thank you! where can i find a coding mentor? someone i can contact for help with outside projects? JavaScript is for some reason incredibly difficult for me. I need to know how to make slideshows and forms for sites, etc.


#6

Just keep posting your questions in the forums. We try to encourage public posting so everyone can see the questions and participate.


#7

There will always be people who can help you on this site, outside project or codecademy problem. However if you are willing to pay for it you could try a site like https://www.codementor.io/javascript-experts.


#8

thank you both. but im not sure how i would get help creating a slideshow or online store here on the forum


#9

Search for the course with the Flipboard, an easy jQuery slideshow. The course may be slated for removal, but if it is still up, I believe it is called Build and Interactive Website.


#10

You can start by simply googling what you are wanting to do. Find a resource that shows you how to code it. Have a go doing it yourself first, if you cannot acomplish it post your code here and somone will help you.


#11

@mtf how are you always before me? haha. You're so quick :slight_smile:


#13

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