Chapter 7 - Javascript: Introduction To Scripting: Outline
Chapter 7 - Javascript: Introduction To Scripting: Outline
Scripting
Outline
7.1 Introduction
7.2 Simple Program: Printing a Line of Text in a Web Page
7.3 Obtaining User Input with prompt Dialogs
7.3.1 Dynamic Welcome Page
7.3.2 Adding Integers
7.4 Memory Concepts
7.5 Arithmetic
7.6 Decision Making: Equality and Relational Operators
7.7 Web Resources
\' Single quote. Used to represent a single quote character in a string. For
example,
window.alert( '\'in quotes\'' );
displays 'in quotes' in an alert dialog.
Fig. 7.7 Prompt dialog displayed by the window object’s prompt method.
number1 45
Fig. 7.9 Memory location showing the name and value of variable number1.
number1 45
number2 72
Fig. 7.10 Memory locations after values for variables number1 and number2 have been input.
number1 45
number2 72
sum 117
Fig. 7.11 Memory locations after calculating the sum of number1 and number2.
Subtraction - p–c p - c
Multiplication * bm b * m
/ x-- x / y
Division x / y or y
or xy
Remainder % r mod s r % s
Fig. 7.12 Arithmetic operators.
2 * 5 is 10 (Leftmost multiplication)
Step 2. y = 10 * 5 + 3 * 5 + 7;
10 * 5 is 50 (Leftmost multiplication)
Step 3. y = 50 + 3 * 5 + 7;
Step 4. y = 50 + 15 + 7;
50 + 15 is 65 (Leftmost addition)
Step 5. y = 65 + 7;
65 + 7 is 72 (Last addition)