Skip to content

Example code from the book JavaScript: The Definitive Guide, 7th Edition

License

Notifications You must be signed in to change notification settings

davidflanagan/jstdg7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example code from JavaScript: The Definitive Guide

The cover of JavaScript: The Definitive Guide

This repo includes all of the numbered examples from the 7th edition of my book, plus many unnumbered examples as well. In general, if an unnumbered example defines a function that seems like it might be useful to someone, I've included it here. The code is listed below in roughly the same order as in the book. To locate code, just look below for the example number or section number that the code appears in.

This code is far more useful when studied in the context of the book in which it appears, and I'd ask you to please buy yourself a copy if you are able to. These examples are free for everyone to use.

If you discover problems with this repo, or bugs in the code, please open a GitHub issue. (Note, however, that I will not accept pull requests because I need to maintain clear copyright to the code so that I can use it in future editions of the book.)

Chapter 1: Introduction to JavaScript

  • Example 1-1: Computing character frequency histograms with JavaScript

Chapter 3: Types, Values, and Variables

Chapter 6: Objects

Chapter 7: Arrays

  • §7.8.6: Array Searching and Sorting Methods
  • §7.9: Array-Like Objects

Chapter 8: Functions

Chapter 9: Classes

  • Example 9-1: A simple JavaScript class
  • Example 9-2: A Range class using a constructor
  • Example 9-3: The Range class rewritten using class
  • Example 9-4: Complex.js: a complex number class
  • Example 9-5: Span.js: a simple subclass of Range
  • §9.5.2: Subclasses with extends and super
  • Example 9-6: TypedMap.js: a subclass of Map that checks key and value types
  • Example 9-7: Histogram.js: a Set-like class implemented with delegation
  • Example 9-8: Sets.js: a hierarchy of abstract and concrete set classes

Chapter 10: Modules

  • §10.1: Modules with Classes, Objects, and Closures

Chapter 11: The JavaScript Standard Library

Chapter 12: Iterators and Generators

Chapter 13: Asynchronous JavaScript

Chapter 14: Metaprogramming

Chapter 15: JavaScript in Web Browsers

Chapter 16: Server-Side JavaScript with Node

About

Example code from the book JavaScript: The Definitive Guide, 7th Edition

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published