dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need some help with Code Academy

  1. #1
    Join Date
    Feb 2013
    Posts
    1

    Need some help with Code Academy

    I'm taking a course at my local college for programming, and one of the assignments is going to code academy. Which I don't like because I don't think it explains good enough for what it wants you to do. But anyways here is the description of the exercise.

    "Write code that contains an if/else statement, just like we did in the last exercise. When your condition is true, print to the console "I am right". When it is false, print to the console "I am wrong". Make sure your statement evaluates to false so it prints out "I am wrong".

    Ok I found the answer online because I couldn't figure it out, here it is.

    if (10 > 5 * 2) {
    alert("Let's go down the first road!");
    } else {
    console.log(1);
    console.log("Oops, please try again");
    }

    So my question is what does it mean when it says console.log(1); What does the (1) mean?

  2. #2
    Join Date
    Feb 2013
    Posts
    1
    Quote Originally Posted by hotrod624 View Post
    I'm taking a course at my local college for programming, and one of the assignments is going to code academy. Which I don't like because I don't think it explains good enough for what it wants you to do. But anyways here is the description of the exercise.

    "Write code that contains an if/else statement, just like we did in the last exercise. When your condition is true, print to the console "I am right". When it is false, print to the console "I am wrong". Make sure your statement evaluates to false so it prints out "I am wrong".

    Ok I found the answer online because I couldn't figure it out, here it is.

    if (10 > 5 * 2) {
    alert("Let's go down the first road!");
    } else {
    console.log(1);
    console.log("Oops, please try again");
    }

    So my question is what does it mean when it says console.log(1); What does the (1) mean?
    I just started using code-academy yesterday.

    "if (10 > 1 * 2)
    {
    console.log("I am right");
    }
    else
    {
    console.log("I am wrong");
    }
    Is a similar answer I gave, console.log(1) doesn't need to be there.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles