Programming wiht JavaScript
Introduction and Chapter 1a, pages 1-24
A Script is a series of instructions that a computer can follow to achieve a goal. JavaScript can be used in the browser to access the page’s content, modify the page’s content, react to events triggered by the user or browser, and provide program rules or instruction the browser can follow. Before start writing the coding, create a big picture that you want to achieve, and break that down into smaller steps. 1) Define the goal 2) Design the script 3) Code each step.
Chapter 2, pages 74-79
An expression is any valid unit of code that resolves to a value. There are two types of expressions. 1) Expressions that assign a value to a variable, 2) Expressions that use two or more values to return a single value. Expressions rely on things called Operators. JavaScript contains mathematical operators such as ADDITION (+), SUBTRACTION (-), DIVISION (/), MULTIPLICATION (*), INCREMENT (++), DECREMENT (–), and MODULUS (%).
Chapter 3: Functions: 88 - 94
Every programmer needs to know fucntions, methods and objects to organize their code. A function in JavaScript is similar to a procedure—a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is a relationship between the input and the output. For example, if you want to add two numbers in multiple places, the function (reuse) can be used instead of repeating the same statement in various places.
function add (a,b)
{
return a + b ;
}