JavaScript Pocket Reference, 3rd Edition

Book description

JavaScript is the ubiquitous programming language of the Web, and for more than 15 years, JavaScript: The Definitive Guide has been the bible of JavaScript programmers around the world. Ideal for JavaScript developers at any level, this book is an all-new excerpt of The Definitive Guide, collecting the essential parts of that hefty volume into this slim yet dense pocket reference.

The first 9 chapters document the latest version (ECMAScript 5) of the core JavaScript language, covering:

  • Types, values, and variables
  • Operators, expressions, and statements
  • Objects and arrays
  • Functions and classes

The next 5 chapters document the fundamental APIs for using JavaScript with HTML5 and explain how to:

  • Interact with web browser windows
  • Script HTML documents and document elements
  • Modify and apply CSS styles and classes
  • Respond to user input events
  • Communicate with web servers
  • Store data locally on the user's computer

This book is a perfect companion to jQuery Pocket Reference.

Publisher resources

View/Submit Errata

Table of contents

  1. JavaScript Pocket Reference
  2. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  3. Preface
  4. 1. Lexical Structure
    1. Comments
    2. Identifiers and Reserved Words
    3. Optional Semicolons
  5. 2. Types, Values, and Variables
    1. Numbers
    2. Text
      1. String Literals
    3. Boolean Values
    4. null and undefined
    5. The Global Object
    6. Type Conversions
    7. Variable Declaration
  6. 3. Expressions and Operators
    1. Expressions
      1. Initializers
      2. Property Access
      3. Function Definition
      4. Invocation
      5. Object Creation
    2. Operators
    3. Arithmetic Operators
    4. Relational Operators
    5. Logical Expressions
    6. Assignment Expressions
    7. Evaluation Expressions
    8. Miscellaneous Operators
      1. The Conditional Operator (?:)
      2. The typeof Operator
      3. The delete Operator
      4. The void Operator
      5. The Comma Operator (,)
  7. 4. Statements
    1. Expression Statements
    2. Compound and Empty Statements
    3. Declaration Statements
      1. var
      2. function
    4. Conditionals
      1. if
      2. else if
      3. switch
    5. Loops
      1. while
      2. do/while
      3. for
      4. for/in
    6. Jumps
      1. Labeled Statements
      2. break
      3. continue
      4. return
      5. throw
      6. try/catch/finally
    7. Miscellaneous Statements
      1. with
      2. debugger
      3. “use strict”
  8. 5. Objects
    1. Creating Objects
      1. Object Literals
      2. Creating Objects with new
      3. Prototypes
      4. Object.create()
    2. Properties
      1. Querying and Setting Properties
      2. Property Inheritance
      3. Deleting Properties
      4. Testing Properties
      5. Enumerating Properties
      6. Serializing Properties and Objects
      7. Property Getters and Setters
      8. Property Attributes
    3. Object Attributes
      1. The prototype Attribute
      2. The class Attribute
      3. The extensible Attribute
  9. 6. Arrays
    1. Creating Arrays
    2. Array Elements and Length
    3. Iterating Arrays
    4. Multidimensional Arrays
    5. Array Methods
      1. join()
      2. reverse()
      3. sort()
      4. concat()
      5. slice()
      6. splice()
      7. push() and pop()
      8. unshift() and shift()
      9. toString()
    6. ECMAScript 5 Array Methods
      1. forEach()
      2. map()
      3. filter()
      4. every() and some()
      5. reduce(), reduceRight()
      6. indexOf() and lastIndexOf()
    7. Array Type
    8. Array-Like Objects
    9. Strings as Arrays
  10. 7. Functions
    1. Defining Functions
      1. Nested Functions
    2. Invoking Functions
      1. Function Invocation
      2. Method Invocation
      3. Constructor Invocation
      4. Indirect Invocation
    3. Function Arguments and Parameters
      1. Optional Parameters
      2. Variable-Length Argument Lists: The Arguments Object
    4. Functions as Namespaces
    5. Closures
    6. Function Properties, Methods, and Constructor
      1. The length Property
      2. The prototype Property
      3. The bind() Method
      4. The toString() Method
      5. The Function() Constructor
  11. 8. Classes
    1. Classes and Prototypes
    2. Classes and Constructors
      1. Constructors and Class Identity
      2. The constructor Property
    3. Java-Style Classes in JavaScript
    4. Immutable Classes
    5. Subclasses
    6. Augmenting Classes
  12. 9. Regular Expressions
    1. Describing Patterns with Regular Expressions
      1. Literal Characters
      2. Character Classes
      3. Repetition
        1. Nongreedy repetition
      4. Alternation, Grouping, and References
      5. Specifying Match Position
      6. Flags
    2. Matching Patterns with Regular Expressions
      1. String Methods for Pattern-Matching
      2. RegExp Properties and Methods
  13. 10. Client-Side JavaScript
    1. Embedding JavaScript in HTML
    2. Event-Driven Programming
    3. The Window Object
      1. Timers
      2. Browser Location and Navigation
      3. Browsing History
      4. Browser and Screen Information
      5. Dialog Boxes
      6. Document Elements as Window Properties
      7. Multiple Windows and Frames
        1. Relationships Between Frames
        2. JavaScript in Interacting Windows
        3. The Same-Origin Policy
  14. 11. Scripting Documents
    1. Overview of the DOM
    2. Selecting Document Elements
      1. Selecting Elements by ID
      2. Selecting Elements by Name
      3. Selecting Elements by Type
      4. Selecting Elements by CSS Class
      5. Selecting Elements with CSS Selectors
    3. Document Structure and Traversal
    4. Attributes
    5. Element Content
      1. Element Content as HTML
      2. Element Content as Plain Text
      3. Element Content as Text Nodes
    6. Creating, Inserting, and Deleting Nodes
    7. Element Style
    8. Geometry and Scrolling
  15. 12. Handling Events
    1. Types of Events
      1. Form Events
      2. Window Events
      3. Mouse Events
      4. Key Events
      5. HTML5 Events
      6. Touchscreen and Mobile Events
    2. Registering Event Handlers
      1. Setting Event Handler Properties
      2. Setting Event Handler Attributes
      3. addEventListener()
    3. Event Handler Invocation
      1. Event Handler Argument
      2. Event Handler Context
      3. Event Handler Scope
      4. Handler Return Value
      5. Event Propagation
      6. Event Cancellation
  16. 13. Networking
    1. Using XMLHttpRequest
      1. Specifying the Request
      2. Retrieving the Response
      3. HTTP Progress Events
      4. Cross-Origin HTTP Requests
    2. HTTP by <script>: JSONP
    3. Server-Sent Events
    4. WebSockets
  17. 14. Client-Side Storage
    1. localStorage and sessionStorage
      1. Storage Lifetime and Scope
      2. Storage API
      3. Storage Events
    2. Cookies
      1. Cookie Attributes: Lifetime and Scope
      2. Setting Cookies
      3. Reading Cookies
      4. Cookie Limitations
  18. Index
  19. About the Author
  20. Colophon
  21. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  22. Copyright

Product information

  • Title: JavaScript Pocket Reference, 3rd Edition
  • Author(s): David Flanagan
  • Release date: April 2012
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449335991