Scripting for IXD

Lesson 2: Numbers and Math

Numbers and Math

In this module we'll take a short break from IxD1 and focus just on basic scripting principles. Specific scripting skills we'll cover include:

Read the following from the Duckett text:

  • Ch. 1c
  • Ch. 2, pp.53-63, 69, 74-77

Note that we skip some sections here but will return to them in later modules. You are welcome to skim them.

Presentation and Demo

Watch this presentation and play along in the demo provided in CULearn. Use this handout to take notes.

Study Questions

  1. What is progressive enhancement?
  2. SKILL: Create a JavaScript file.
  3. SKILL: Add JavaScript to HTML documents directly and by linking to separate scripts.
  4. What are statements?
  5. What are comments?
  6. SKILL: Add single-line and multi-line comments in JavaScript.
  7. What is a variable?
  8. SKILL: Declare variables and assign them values in JavaScript.
  9. What are data types?
  10. List three of the common data types.
  11. SKILL: Output content to the browser console.

Commit to Memory

The var keyword and its use.

The following mathematical operators and their use:

  • +
  • -
  • *
  • /
  • %
  • ++
  • --

The following assignment operators and their use:

  • =
  • +=
  • -=

The expression syntax:

__v1__ _o_ __v2__ : v1 and v2 are values; o is an operator

The console log syntax:

console.log(__1__); : 1 is any valid value be literal data or an expression