javascript comprehensive overview
TRANSCRIPT
![Page 1: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/1.jpg)
JavaScriptMohamed Loey
![Page 2: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/2.jpg)
Agenda
Part I: Introduction
Part II: JavaScript Syntax
![Page 3: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/3.jpg)
Agenda
Part I: IntroductionWhat is JavaScript? JavaScript In HTML JavaScript Can
![Page 4: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/4.jpg)
What is JavaScript?• JavaScript is the first Web scripting
language, developed by Netscape in 1995• JavaScript is a scripting language. It is a
lightweight, but powerful, programming language.
• JavaScript similarities to Java/C++• JavaScript is Client-side web programming• JavaScript is the most popular
programming language in the world.
![Page 5: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/5.jpg)
JavaScript In HTML• In HTML, JavaScripts must be inserted
between <script> and </script> tags.• JavaScripts can be put in the <body>
and in the <head> section of an HTML page.
• Two Ways to Insert JavaScript:1. Internal script2. External script sheet
![Page 6: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/6.jpg)
Internal script
• Scripts can be placed in the <body> or in the <head> section of HTML, and/or in both.
• Example:
![Page 7: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/7.jpg)
External script sheet
• Scripts can also be placed in external files.
• External scripts are practical when the same code is used in many different web pages.
• JavaScript files have the file extension .js.• To use an external script, put the name of
the script file in the source (src) attribute of the <script> tag
![Page 8: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/8.jpg)
External script sheet
• Example:
![Page 9: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/9.jpg)
JavaScript Can
• Change HTML Elements• Change HTML Attributes• Change HTML Styles (CSS)• Validate Data
![Page 10: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/10.jpg)
Agenda
Part II: JavaScript Syntax JavaScript is Case Sensitive JavaScript Comments JavaScript Variables JavaScript Conditions JavaScript Loops JavaScript Arrays
![Page 11: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/11.jpg)
JavaScript is Case Sensitive
• In JavaScript all identifiers are case sensitive.
• The variables lastName and lastname, are two different variables.
• The functions myFunction and myfunction, are two different functions.
• JavaScript does not interpret Var; as var.
![Page 12: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/12.jpg)
JavaScript Comments
• Single Line Comments• Single line comments start with //.
• Multi-line Comments• Multi-line comments start with /* and
end with */.
![Page 13: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/13.jpg)
JavaScript Variables
• JavaScript uses the var keyword to define variables
• Example:
![Page 14: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/14.jpg)
JavaScript Variables
• JavaScript uses the var keyword to define variables
• Example:
![Page 15: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/15.jpg)
JavaScript Conditions
• In JavaScript we have the following conditional statements:1. Use if to specify a block of code to be
executed, if a specified condition is true2. Use else to specify a block of code to be
executed, if the same condition is false3. Use else if to specify a new condition to
test, if the first condition is false4. Use switch to specify many alternative
blocks of code to be executed
![Page 16: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/16.jpg)
JavaScript Conditions
• Example:
![Page 17: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/17.jpg)
JavaScript Loops
• JavaScript supports different kinds of loops:1. for - loops through a block of code a
number of times2. for/in - loops through the properties of an
object3. while - loops through a block of code while
a specified condition is true4. do/while - also loops through a block of
code while a specified condition is true
![Page 18: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/18.jpg)
JavaScript Loops
• Example:
![Page 19: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/19.jpg)
JavaScript Arrays
• JavaScript arrays are used to store multiple values in a single variable.
• Example:
![Page 20: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/20.jpg)
JavaScript Functions
• A JavaScript function is a block of code designed to perform a particular task.
• A JavaScript function is executed when "something" invokes it (calls it).
• Example:
![Page 21: JavaScript Comprehensive Overview](https://reader036.vdocument.in/reader036/viewer/2022062905/540cc67a7bef0a84278b6220/html5/thumbnails/21.jpg)
THANK U