0%

Book Description

Exploit the Power of Modern JavaScript and Avoid the Pitfalls

JavaScript was originally designed for small-scale programming in web browsers, but modern JavaScript is radically different. Nowadays, JavaScript programmers actively embrace functional, object-oriented, and asynchronous programming, while deprecating error-prone concepts from the past. Modern JavaScript for the Impatient is a complete yet concise guide to JavaScript E6 and beyond. Rather than first requiring you to learn and transition from older versions, it helps you quickly get productive with today's far more powerful versions and rapidly move from languages such as Java, C#, C, or C++.

Bestselling programming author Cay S. Horstmann covers all you need to know, provided in small chunks organized for quick access and easy understanding. Horstmann's practical insights and sample code help you take advantage of all that's new, avoid common pitfalls and obsolete features, and make the most of modern JavaScript's robust toolchains and frameworks.

  • Quickly master modern JavaScript's implementation of fundamental programming constructs
  • Avoid legacy techniques that create unnecessary complexity and risk
  • Make the most of functional, object-oriented, and asynchronous techniques
  • Use modules to efficiently organize and run complex programs
  • Write more powerful, flexible, and concise programs with metaprogramming
  • Extend JavaScript's power via JavaScript libraries, frameworks, and platforms

Whether you're just getting started with JavaScript or you're an experienced developer, this guide will help you write tomorrow's most robust, efficient, and secure JavaScript code.

Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.

Table of Contents

  1. Cover Page
  2. About This eBook
  3. Half Title Page
  4. Title Page
  5. Copyright Page
  6. Dedication Page
  7. Contents
  8. Preface
  9. About the Author
  10. Chapter 1. Values and Variables
    1. 1.1 Running JavaScript
    2. 1.2 Types and the typeof Operator
    3. 1.3 Comments
    4. 1.4 Variable Declarations
    5. 1.5 Identifiers
    6. 1.6 Numbers
    7. 1.7 Arithmetic Operators
    8. 1.8 Boolean Values
    9. 1.9 null and undefined
    10. 1.10 String Literals
    11. 1.11 Template Literals
    12. 1.12 Objects
    13. 1.13 Object Literal Syntax
    14. 1.14 Arrays
    15. 1.15 JSON
    16. 1.16 Destructuring
    17. 1.17 Advanced Destructuring
    18. Exercises
  11. Chapter 2. Control Structures
    1. 2.1 Expressions and Statements
    2. 2.2 Semicolon Insertion
    3. 2.3 Branches
    4. 2.4 Boolishness
    5. 2.5 Comparison and Equality Testing
    6. 2.6 Mixed Comparisons
    7. 2.7 Boolean Operators
    8. 2.8 The switch Statement
    9. 2.9 while and do Loops
    10. 2.10 for Loops
    11. 2.11 Breaking and Continuing
    12. 2.12 Catching Exceptions
    13. Exercises
  12. Chapter 3. Functions and Functional Programming
    1. 3.1 Declaring Functions
    2. 3.2 Higher-Order Functions
    3. 3.3 Function Literals
    4. 3.4 Arrow Functions
    5. 3.5 Functional Array Processing
    6. 3.6 Closures
    7. 3.7 Hard Objects
    8. 3.8 Strict Mode
    9. 3.9 Testing Argument Types
    10. 3.10 Supplying More or Fewer Arguments
    11. 3.11 Default Arguments
    12. 3.12 Rest Parameters and the Spread Operator
    13. 3.13 Simulating Named Arguments with Destructuring
    14. 3.14 Hoisting
    15. 3.15 Throwing Exceptions
    16. 3.16 Catching Exceptions
    17. 3.17 The finally Clause
    18. Exercises
  13. Chapter 4. Object-Oriented Programming
    1. 4.1 Methods
    2. 4.2 Prototypes
    3. 4.3 Constructors
    4. 4.4 The Class Syntax
    5. 4.5 Getters and Setters
    6. 4.6 Instance Fields and Private Methods
    7. 4.7 Static Methods and Fields
    8. 4.8 Subclasses
    9. 4.9 Overriding Methods
    10. 4.10 Subclass Construction
    11. 4.11 Class Expressions
    12. 4.12 The this Reference
    13. Exercises
  14. Chapter 5. Numbers and Dates
    1. 5.1 Number Literals
    2. 5.2 Number Formatting
    3. 5.3 Number Parsing
    4. 5.4 Number Functions and Constants
    5. 5.5 Mathematical Functions and Constants
    6. 5.6 Big Integers
    7. 5.7 Constructing Dates
    8. 5.8 Date Functions and Methods
    9. 5.9 Date Formatting
    10. Exercises
  15. Chapter 6. Strings and Regular Expressions
    1. 6.1 Converting between Strings and Code Point Sequences
    2. 6.2 Substrings
    3. 6.3 Other String Methods
    4. 6.4 Tagged Template Literals
    5. 6.5 Raw Template Literals
    6. 6.6 Regular Expressions
    7. 6.7 Regular Expression Literals
    8. 6.8 Flags
    9. 6.9 Regular Expressions and Unicode
    10. 6.10 The Methods of the RegExp Class
    11. 6.11 Groups
    12. 6.12 String Methods with Regular Expressions
    13. 6.13 More about Regex Replace
    14. 6.14 Exotic Features
    15. Exercises
  16. Chapter 7. Arrays and Collections
    1. 7.1 Constructing Arrays
    2. 7.2 The length Property and Index Properties
    3. 7.3 Deleting and Adding Elements
    4. 7.4 Other Array Mutators
    5. 7.5 Producing Elements
    6. 7.6 Finding Elements
    7. 7.7 Visiting All Elements
    8. 7.8 Sparse Arrays
    9. 7.9 Reduction
    10. 7.10 Maps
    11. 7.11 Sets
    12. 7.12 Weak Maps and Sets
    13. 7.13 Typed Arrays
    14. 7.14 Array Buffers
    15. Exercises
  17. Chapter 8. Internationalization
    1. 8.1 The Locale Concept
    2. 8.2 Specifying a Locale
    3. 8.3 Formatting Numbers
    4. 8.4 Localizing Dates and Times
    5. 8.5 Collation
    6. 8.6 Other Locale-Sensitive String Methods
    7. 8.7 Plural Rules and Lists
    8. 8.8 Miscellaneous Locale Features
    9. Exercises
  18. Chapter 9. Asynchronous Programming
    1. 9.1 Concurrent Tasks in JavaScript
    2. 9.2 Making Promises
    3. 9.3 Immediately Settled Promises
    4. 9.4 Obtaining Promise Results
    5. 9.5 Promise Chaining
    6. 9.6 Rejection Handling
    7. 9.7 Executing Multiple Promises
    8. 9.8 Racing Multiple Promises
    9. 9.9 Async Functions
    10. 9.10 Async Return Values
    11. 9.11 Concurrent Await
    12. 9.12 Exceptions in Async Functions
    13. Exercises
  19. Chapter 10. Modules
    1. 10.1 The Module Concept
    2. 10.2 ECMAScript Modules
    3. 10.3 Default Imports
    4. 10.4 Named Imports
    5. 10.5 Dynamic Imports
    6. 10.6 Exports
    7. 10.7 Packaging Modules
    8. Exercises
  20. Chapter 11. Metaprogramming
    1. 11.1 Symbols
    2. 11.2 Customization with Symbol Properties
    3. 11.3 Property Attributes
    4. 11.4 Enumerating Properties
    5. 11.5 Testing a Single Property
    6. 11.6 Protecting Objects
    7. 11.7 Creating or Updating Objects
    8. 11.8 Accessing and Updating the Prototype
    9. 11.9 Cloning Objects
    10. 11.10 Function Properties
    11. 11.11 Binding Arguments and Invoking Methods
    12. 11.12 Proxies
    13. 11.13 The Reflect Class
    14. 11.14 Proxy Invariants
    15. Exercises
  21. Chapter 12. Iterators and Generators
    1. 12.1 Iterable Values
    2. 12.2 Implementing an Iterable
    3. 12.3 Closeable Iterators
    4. 12.4 Generators
    5. 12.5 Nested Yield
    6. 12.6 Generators as Consumers
    7. 12.7 Generators and Asynchronous Processing
    8. 12.8 Async Generators and Iterators
    9. Exercises
  22. Chapter 13. An Introduction to Typescript
    1. 13.1 Type Annotations
    2. 13.2 Running TypeScript
    3. 13.3 Type Terminology
    4. 13.4 Primitive Types
    5. 13.5 Composite Types
    6. 13.6 Type Inference
    7. 13.7 Subtypes
    8. 13.8 Classes
    9. 13.9 Structural Typing
    10. 13.10 Interfaces
    11. 13.11 Indexed Properties
    12. 13.12 Complex Function Parameters
    13. 13.13 Generic Programming
    14. Exercises
  23. Index
  24. Code Snippets
3.17.184.90