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.


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
    Thanked 0 Times in 0 Posts

    Default codecademy Java Script


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



    return "Get some more shut eye!";


    Reegards TyffaN

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Washington, DC
    My Mood
    Thanked 698 Times in 595 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.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

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, 03:13 PM
  3. how to parse JSON using java script
    By mikeclark in forum Member Introductions
    Replies: 1
    Last Post: December 8th, 2012, 10: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, 08:28 PM