A script is a series of instructions that a computer can follow to achieve a goal.
A script are made up of instructions a computer can follow step-by-step.
A browser may use different parts of the script depending on how the user interacts with the web page.
Script can run different sections of the code in response of the situation around them.
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
An expression evaluates into (results in) a single value. Broadly speaking there are two types of expressions.
EXPRESSIONS THAT JUST ASSIGN A VALUE TO A VARIABLE In order for a variable to be useful, it needs to be given a value. As you have seen, this is done using the assignment operator (the equals sign). var color = ‘beige’; The value of co 1 or is now beige.
EXPRESSIONS THAT USE TWO OR MORE VALUES TO RETURN A SINGLE VALUE You can perform operations on any number of individual values (see next page) to determine a single value. For example: var area = 3 * 2; The value of area is now 6.
Access contact You can use JavaScript to select any element, attribute, or text from an HTML page Modify content You can use JavaScript to add elements, attributes, and text to the page, or remove them. Program rules You can specify a set of steps for the browser to follow (like a recipe), which allows it to access or change the content of a page. React to event You can specify that a script should run when a specific event has occurred.