Hour 2. Writing Simple Scripts

What You’ll Learn in This Hour

• Various ways to include JavaScript in your web pages

• The basic syntax of JavaScript statements

• How to declare and use variables

• Using mathematical operators

• How to comment your code

• Capturing mouse events

You learned in Hour 1, “Introducing JavaScript,” that JavaScript is a scripting language capable of making web pages more interactive.

In this hour you learn more about how JavaScript can be added to your web page and then about some of the fundamental syntax of your JavaScript programs such as statements, variables, operators, and comments. You’ll also get your hands dirty with more worked examples.

Including JavaScript in Your Web Page

In the previous hour we said ...

Get Sams Teach Yourself JavaScript™ in 24 Hours, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.