Skip to Content
JavaScript: The Definitive Guide, Fourth Edition
book

JavaScript: The Definitive Guide, Fourth Edition

by David Flanagan
November 2001
Intermediate to advanced
936 pages
68h 43m
English
O'Reilly Media, Inc.
Content preview from JavaScript: The Definitive Guide, Fourth Edition

Function Scope: The Call Object

As described in Chapter 4, the body of a JavaScript function executes in a local scope that differs from the global scope. This new scope is created by adding the call object to the front of the scope chain. Since the call object is part of the scope chain, any properties of this object are accessible as variables within the body of the function. Local variables declared with the var statement are created as properties of this object; the parameters of the function are also made available as properties of the object.

In addition to local variables and parameters, the call object defines one special property named arguments. This property refers to another special object known as the Arguments object, which is discussed in the next section. Because the arguments property is a property of the call object, it has exactly the same status as local variables and function parameters. For this reason, the identifier arguments should be considered a reserved word and should not be used as a variable or parameter name.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

JavaScript: A Beginner's Guide, Fourth Edition, 4th Edition

JavaScript: A Beginner's Guide, Fourth Edition, 4th Edition

John Pollock
JavaScript Cookbook, 3rd Edition

JavaScript Cookbook, 3rd Edition

Adam D. Scott, Matthew MacDonald, Shelley Powers

Publisher Resources

ISBN: 0596000480Supplemental ContentCatalog PageErrata