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
- What is progressive enhancement?
- SKILL: Create a JavaScript file.
- SKILL: Add JavaScript to HTML documents directly and by linking to separate scripts.
- What are statements?
- What are comments?
- SKILL: Add single-line and multi-line comments in JavaScript.
- What is a variable?
- SKILL: Declare variables and assign them values in JavaScript.
- What are data types?
- List three of the common data types.
- 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