** A script is a series of instructions that a computer can follow to achieve a goal. **
** To write a script, you need to first state your goal and then list the tasks that need to be completed in order to achieve it. **
Start with the big picture of what you want to achieve, and break that down into smaller steps.
First, you need to define the task you want to achieve.
To design a script you split the goal out into a series of tasks. This can be represented using a flowchart.
Each of the steps needs to be written in a programming language that the compu ter understands.
An expression evaluates into a single value. there are two types of expressions.
var color = ‘beige’;
var area = 3 * 2;
Expressions rely on things called operators; they allow programmers to create a single value from one or more values.
Assign a value to a variable color = ‘beige’;
Perform basic math area = 3 * 2;
Combine two strings greeting= ‘Hi 1 + ‘Mol ly’;
Compare two values and return true or false buy = 3 > 5;
Combine expressions and return true or false buy= (5 > 3) && (2 < 4);
A JavaScript function is a block of code designed to perform a particular task.
** Functions allow you to group a set of related statements together that represent a single task. **
** Functions can take parameters (information required to do their job) and may return a value. **