O'Reilly logo

Internet & World Wide Web: How to Program, Fifth Edition by Abbey Deitel, Harvey Deitel, Paul Deitel

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

9. JavaScript: Functions

E pluribus unum. (One composed of many.)

—Virgil

Call me Ishmael.

—Herman Melville

When you call me that, smile.

—Owen Wister

O! call back yesterday, bid time return.

—William Shakespeare

Objectives

In this chapter you will:

• Construct programs modularly from small pieces called functions.

• Define new functions.

• Pass information between functions.

• Use simulation techniques based on random number generation.

• Use the new HTML5 audio and video elements

• Use additional global methods.

• See how the visibility of identifiers is limited to specific regions of programs.

Outline

9.1 Introduction

9.2 Program Modules in JavaScript

9.3 Function Definitions

9.3.1 Programmer-Defined Function square

9.3.2 Programmer-Defined ...

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