O'Reilly logo

Sams Teach Yourself JavaScript™ in 24 Hours, Fifth Edition by Phil Ballard, Michael Moncur

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required