Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Here is my collection on JavaScript lectures. It includes tutorials as well as general concepts explanations. Particularly these slides contain: Introduction to Scripting, Basic Memory Concepts, Arithmetic Operators, Decision-Making Statements, Relational and Equality Operators, Using Input and Output Stat, Simple Javascript Programs
Typology: Slides
1 / 26
Topics Covered
Introduction
JavaScript: Object-Based Language
Scripting
Scripting
1 2 4 5 6 7 8 9
10 Escape character in combination with quotation mark: \” will result in insertion of a quotation mark in the string that is actually written by JavaScript
1 2 4 5 6 7 8 9
New line of the html document in a browser is determined by an html
element
1 2 4 5 6 7 8 9
Click Refresh (or Reload) to run this script again.
21 22alert method of the object displays a Dialog
Common Escape Sequences
Dynamic Pages
the user or other information
of a window object
1 2 4 5 6 7 8 9
10 “+” symbol can be used for text concatenation as well as arithmetic operator
24 25 26
27Click Refresh (or Reload) to run this script again.
28 29This is the prompt to the user.
This is the default value that appears when the dialog opens.
This is the text field in which the user types the value.
When the user clicks OK , the value typed by the user is returned to the program as a string.
If the user clicks Cancel , the null value will be returned to the program and no value will be assigned to the variable.
Simple Script Example: Adding Integers
1 2 4 5 6 7 8 9
10Click Refresh (or Reload) to run the script again
43 44Arithmetic Operators and order of evaluation
JavaScript operation
Arithmetic operator
Algebraic expression
JavaScript expression Addition +^ f + 7 f + 7 Subtraction -^ p – c p^ -^ c Multiplication *^ bm b * m Division /^ x / y or or x y x / y
Remainder %^ r mod s r % s Fig. 7.12 Arithmetic operators.
Operator(s) Operation(s) Order of evaluation (precedence) *, / or % (^) Multiplication Division Modulus
Evaluated first. If there are several such operations, they are evaluated from left to right.
Evaluated last. If there are several such operations, they are evaluated from left to right. Fig. 7.13 Precedence of arithmetic operators.
Relational (Inequality and Equality) Operators
1 2 4 5 6 7 8 9
1047
48Click Refresh (or Reload) to run this script again.
49 50