73 users online (0 members and 73 guests)  




  Results 1 to 1 of 1

Related

  1. Javascript and php code for autocalculation    Forum: Javascript Forum
    Replies: 2
  2. Replies: 0
  3. Replies: 5
  4. Online Training Academy needs review    Forum: Show it off!
    Replies: 4
  5. Replies: 4
  1. #1
    RF2OOO's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Aug 2010
    Posts
    29

    Wink Code Academy Answer Key - Introduction To Programming With Javascript


    Code Academy makes learning Javascript and other programming languages easy and fun! You don't have to join the site in order to learn but it is a good idea to try out each exercise on your own before checking out the answers. By the time you complete all the exercises, you'll have a basic understanding of how javascript works and will be able to create your own with ease! I found the site extremely helpful and decided to create this answer key to help anyone interested in learning javascript. Enjoy!

    Introduction Exercise 0 - Name
    Code:
    "unknown"
    Introduction Exercise 1 - Character Length
    Code:
    "unknown".length
    Introduction Exercise 2 - Simple Math
    Code:
    3 + 4
    Introduction Exercise 3 - More Simple Math
    Code:
    100 / 20
    Introduction Exercise 4 - Reference Error
    Code:
    eggplant
    Section 1 Exercise 0 - Character Length Plus Simple Math
    Code:
    "cake".length * 9
    Section 1 Exercise 1 - Executing Javascript
    Code:
    // click Run
    Section 1 Exercise 2 - Interactive Javascript
    Code:
    confirm("I feel awesome!");
    confirm("I am ready to go.");
    Section 1 Exercise 3 - Inputs & Javascript
    Code:
    prompt("Where are you from?");
    Section 1 Exercise 4 - Data Types 1 & 2: Numbers & Strings
    Code:
    "This is easy".length
    Section 1 Exercise 5 - Data Type 3: Booleans
    Code:
    "I'm coding like a champ!".length > 10
    Section 2 Exercise 0 - Using Console Log
    Code:
    console.log(2 * 5)
    console.log("Hello")
    Section 2 Exercise 1 - Comparisons
    Code:
    console.log(15 > 4);
    console.log("Xiao Hui".length < 122);
    console.log("Goody Donaldson".length > 8);
    console.log(8 * 2 === 16)
    Section 2 Exercise 2 - Conditional Statements
    Code:
    if (100 > 2); {
        console.log("You are good at math!");
    }
    
    console.log("Just letting you know: your program got to line 6");
    Section 2 Exercise 3 - Else Statements
    Code:
    if (10 > 5 * 2) {
        alert("Let's go down the first road!");
    } else {
        console.log(1);
        console.log("Oops, please try again");
    }
    Section 2 Exercise 4 - More Conditional Statements
    Code:
    if ("computer".length * 2 === 16) {
        console.log(1);
        console.log("I am right");
    } else {
        console.log(0);
        console.log("I am wrong");
    }
    Section 2 Exercise 5 - Java Syntax
    Code:
    if (10 === 10) {
        console.log(1);
        console.log("You got a true!");
    } else {
        console.log(0);
        console.log("You got a false!");
    }
    Section 3 Exercise 0 - Mid-Lesson Review
    Code:
    if (12 / 4 === "Ari".length) {
        confirm("Will this run the first block?");
    } else {
        confirm("Or the second block?");
    }
    Section 3 Exercise 1 - Math
    Code:
    if ("Jon".length * 2 / (2 + 1) === 2) {
        console.log("The answer makes sense!");
    } else {
        console.log(0);
        console.log("Error Error Error");
    }
    Section 3 Exercise 2 - Math & The Modulo
    Code:
    console.log(14 % 3);
    console.log(99 % 8);
    console.log(11 % 3);
    Section 3 Exercise 3 - Modulo & "if / else"
    Code:
    if (99 % 3 === 0) {
        console.log("The first number is even!");
    } else {
        console.log("The first number is odd!");
    }
    Section 3 Exercise 4 - Substrings
    Code:
    "wonderful day".substring(3, 7)
    Section 3 Exercise 5 - More Substrings
    Code:
    console.log("January".substring(0, 3));
    console.log("Melbourne is great".substring(0, 12));
    console.log("Hamburgers".substring(3, 10));
    Section 4 Exercise 0 - Variables
    Code:
    var myAge = 678;
    console.log(myAge);
    Section 4 Exercise 1 - More Variables
    Code:
    var myCountry = "America";
    
    console.log(myCountry.length);
    
    console.log(myCountry.substring(0, 3));
    Section 4 Exercise 2 - Change Variable Values
    Code:
    var myName = "unknown";
    
    console.log(myName);
    
    console.log(myName.substring(0, 2));
    
    console.log(myName);
    Section 4 Exercise 3 - Conclusion Part 1 Review
    Code:
    // lol win
    var myJob = "take a guess";
    console.log(myJob.length);
    Section 4 Exercise 4 - Conclusion Part 2 Final
    Code:
    if ("Code Academy Rocks!!".length * 5 === 100) {
        console.log("I finished my first course!");
        console.log("Success!!!");
    } else {
        console.log("Error Error Error");
        console.log("Please Try Again");
    }
    Last edited by RF2OOO; 10-04-2012 at 06:14 PM. Reason: Grammar correction



Tags for this Thread