JavaScript Summary

This is a more detailed list of things we hope you have learned from the JavaScript tutorial. We couldn’t give you this list before you began the tutorial, because some of it would not have made sense to you. Now that you’ve been through the tutorial, it is here to remind you of what you should have learned.

Introduction to JavaScript (Lessons 1–2)

How to use in JavaScript:

  1. Basic data types: string, boolean, number
  2. Basic string operations: length and substring
  3. Basic arithmetic operations: +, -, *, /, %
  4. Basic comparisons, producing boolean values: >, >=, <, <=, === (is equal to), !== (is not equal to)
  5. Input/output operations: console.log, confirm, prompt
  6. Variables:

    var name = value;
    name = newvalue;
  7. if and if/else statements:

    if (CONDITION)
    {
       STATEMENTs
    }

    and

    if (CONDITION)
    {
       STATEMENTs
    }
    else
    {
       STATEMENTs
    }

Functions (Lessons 3–4)

How to use in JavaScript:

  1. Defining and calling functions:

    var FUNCTION_NAME = function (PARAMETER_NAME) {
       STATEMENTs;
    };
    
    FUNCTION_NAME(PARAMETER_VALUE);
  2. + as string concatenation: "sheep" + "goat" makes "sheepgoat"
  3. DRY: Don’t repeat yourself. The role of parameters.
  4. The return statement.
  5. Functions with more than one parameter.
  6. The concept of scope; global and local variables.

‘For’ Loops in JavaScript (Lessons 5–6)

How to use in JavaScript:

  1. Repetition with for statements:
    1. Initializing the counter
    2. Testing the counter
    3. Updating the counter
    for (var COUNTER = START; COUNTER < TOOFAR; COUNTER++)
    {
        STATEMENTs;
    }
  2. Increment and decrement operators (++, --)
  3. Assignment operators (+=, -=)
  4. Avoid infinite loops.
  5. Arrays for storing lists of data
    1. Creating an array
    2. Accessing data (“elements”) from the array by index (myarray[i])
    3. Using for loops to access all elements of an array
      • myarray.length is the number of elements in the array.
  6. Use of \ to continue a string on the next line.
  7. Array indexing works with strings too (mystring[i])

‘While’ Loops in JavaScript (Lessons 7–8)

How to use in JavaScript:

  1. Repetition with while statements:

    while (CONDITION)
    {
        STATEMENTs;
    }
  2. Avoid infinite loops.
  3. When to use while; when to use for
  4. Repetition with do/while statements: the loop runs at least once, even if its condition is false at the start.

    do
    {
        STATEMENTs;
    }
    while (CONDITION);

Reference

See also Codecademy’s JavaScript Glossary, which is really more of a reference sheet than a glossary. (Parts of the glossary are for topics not assigned for this class.)