Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: codecademy Java Script

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default codecademy Java Script

    Hello!

    I'm stuck at codecademy... Anyone help me? I've tried to slove this for 2 hours but it wont work... When I "run" the program it just says SyntaxError: Unexpected token else

    This is the code 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)

    Reegards TyffaN


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: codecademy Java Script

    This is a Java forum, and JavaScript is a completely different thing.

    That being said, the problem is you're closing your if statement with a semicolon instead of opening it with an opening bracket.

    Edit: I've moved this thread to the "Other Programming Languages" forum.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Codecademy Problem
    By deibicr in forum Other Programming Languages
    Replies: 4
    Last Post: June 19th, 2014, 05:01 PM
  2. Passing a value from applet to java script
    By nat in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 6th, 2014, 04:13 PM
  3. how to parse JSON using java script
    By mikeclark in forum Member Introductions
    Replies: 1
    Last Post: December 8th, 2012, 11:53 PM
  4. Java Script or HTML
    By ravi9999 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 1st, 2012, 09:44 AM
  5. Downloading web page with java script enabled through Java
    By mashimaro in forum Java Networking
    Replies: 1
    Last Post: November 13th, 2010, 09:28 PM