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.2 Program Modules in JavaScript
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.