08.12.2022 Views

javascript_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Table of Contents

About the Tutorial .............................................................................................................................................

Audience ........................................................................................................................................................... i

Prerequisites ..................................................................................................................................................... i

Copyright and Disclaimer ................................................................................................................................. i

Table of Contents ............................................................................................................................................ ii

PART 1: JAVASCRIPT BASICS ........................................................................................................ 1

1. JAVASCRIPT – Overview ............................................................................................................................ 2

What is JavaScript? .......................................................................................................................................... 2

Client-Side JavaScript....................................................................................................................................... 2

Advantages of JavaScript ................................................................................................................................. 3

Limitations of JavaScript .................................................................................................................................. 3

JavaScript Development Tools......................................................................................................................... 3

Where is JavaScript Today? ............................................................................................................................. 4

2. JAVASCRIPT – Syntax ................................................................................................................................ 5

Your First JavaScript Code ............................................................................................................................... 5

Whitespace and Line Breaks ............................................................................................................................ 6

Semicolons are Optional.................................................................................................................................. 6

Case Sensitivity ................................................................................................................................................ 7

Comments in JavaScript .................................................................................................................................. 7

3. JAVASCRIPT – Enabling ............................................................................................................................. 9

JavaScript in Internet Explorer ........................................................................................................................ 9

JavaScript in Firefox ......................................................................................................................................... 9

JavaScript in Chrome ..................................................................................................................................... 10

JavaScript in Opera ........................................................................................................................................ 10

Warning for Non-JavaScript Browsers ........................................................................................................... 10

4. JAVASCRIPT – Placement ........................................................................................................................ 12

JavaScript in <head>...</head> Section ......................................................................................................... 12

JavaScript in <body>...</body> Section ......................................................................................................... 13

JavaScript in <body> and <head> Sections .................................................................................................... 13

JavaScript in External File .............................................................................................................................. 14

5. JAVASCRIPT – Variables .......................................................................................................................... 16

JavaScript Datatypes...................................................................................................................................... 16

JavaScript Variables ....................................................................................................................................... 16

JavaScript Variable Scope .............................................................................................................................. 17

JavaScript Variable Names ............................................................................................................................ 18

JavaScript Reserved Words ........................................................................................................................... 19

6. JAVASCRIPT – Operators ......................................................................................................................... 20

What is an Operator? .................................................................................................................................... 20

Arithmetic Operators..................................................................................................................................... 20

Comparison Operators .................................................................................................................................. 23

Logical Operators ........................................................................................................................................... 26

ii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!