6. JavaScript: Introduction to Scripting

Comment is free, but facts are sacred.

—C. P. Scott

The creditor hath a better memory than the debtor.

—James Howell

When faced with a decision, I always ask, “What would be the most fun?”

—Peggy Walker

Objectives

In this chapter you will:

• Write simple JavaScript programs.

• Use input and output statements.

• Learn basic memory concepts.

• Use arithmetic operators.

• Learn the precedence of arithmetic operators.

• Write decision-making statements to choose among alternative courses of action.

• Use relational and equality operators to compare data items.

Outline

6.1 Introduction

6.2 Your First Script: Displaying a Line of Text with JavaScript in a Web Page

6.3 Modifying Your First Script

6.4 Obtaining ...

Get Internet & World Wide Web: How to Program, 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.