ENGLISH

Modern JavaScript for the Impatient

Book information

Publisher
Addison-Wesley Professional
Year
2020
ISBN
0136502148, 9780136502142
Language
english
Format
PDF
Filesize
7 MB (7424495 bytes)
Edition
1
Pages
352\353
Time added
2021-09-08 08:21:53

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. Cover Half Title Title Page Copyright Page Dedication Contents Preface About the Author 1 VALUES AND VARIABLES 1.1 Running JavaScript 1.2 Types and the typeof Operator 1.3 Comments 1.4 Variable Declarations 1.5 Identifiers 1.6 Numbers 1.7 Arithmetic Operators 1.8 Boolean Values 1.9 null and undefined 1.10 String Literals 1.11 Template Literals 1.12 Objects 1.13 Object Literal Syntax 1.14 Arrays 1.15 JSON 1.16 Destructuring 1.17 Advanced Destructuring 1.17.1 More about Object Destructuring 1.17.2 Rest Declarations 1.17.3 Defaults Exercises 2 CONTROL STRUCTURES 2.1 Expressions and Statements 2.2 Semicolon Insertion 2.3 Branches 2.4 Boolishness 2.5 Comparison and Equality Testing 2.6 Mixed Comparisons 2.7 Boolean Operators 2.8 The switch Statement 2.9 while and do Loops 2.10 for Loops 2.10.1 The Classic for Loop 2.10.2 The for of Loop 2.10.3 The for in Loop 2.11 Breaking and Continuing 2.12 Catching Exceptions Exercises 3 FUNCTIONS AND FUNCTIONAL PROGRAMMING 3.1 Declaring Functions 3.2 Higher-Order Functions 3.3 Function Literals 3.4 Arrow Functions 3.5 Functional Array Processing 3.6 Closures 3.7 Hard Objects 3.8 Strict Mode 3.9 Testing Argument Types 3.10 Supplying More or Fewer Arguments 3.11 Default Arguments 3.12 Rest Parameters and the Spread Operator 3.13 Simulating Named Arguments with Destructuring 3.14 Hoisting 3.15 Throwing Exceptions 3.16 Catching Exceptions 3.17 The finally Clause Exercises 4 OBJECT-ORIENTED PROGRAMMING 4.1 Methods 4.2 Prototypes 4.3 Constructors 4.4 The Class Syntax 4.5 Getters and Setters 4.6 Instance Fields and Private Methods 4.7 Static Methods and Fields 4.8 Subclasses 4.9 Overriding Methods 4.10 Subclass Construction 4.11 Class Expressions 4.12 The this Reference Exercises 5 NUMBERS AND DATES 5.1 Number Literals 5.2 Number Formatting 5.3 Number Parsing 5.4 Number Functions and Constants 5.5 Mathematical Functions and Constants 5.6 Big Integers 5.7 Constructing Dates 5.8 Date Functions and Methods 5.9 Date Formatting Exercises 6 STRINGS AND REGULAR EXPRESSIONS 6.1 Converting between Strings and Code Point Sequences 6.2 Substrings 6.3 Other String Methods 6.4 Tagged Template Literals 6.5 Raw Template Literals 6.6 Regular Expressions 6.7 Regular Expression Literals 6.8 Flags 6.9 Regular Expressions and Unicode 6.10 The Methods of the RegExp Class 6.11 Groups 6.12 String Methods with Regular Expressions 6.13 More about Regex Replace 6.14 Exotic Features Exercises 7 ARRAYS AND COLLECTIONS 7.1 Constructing Arrays 7.2 The length Property and Index Properties 7.3 Deleting and Adding Elements 7.4 Other Array Mutators 7.5 Producing Elements 7.6 Finding Elements 7.7 Visiting All Elements 7.8 Sparse Arrays 7.9 Reduction 7.10 Maps 7.11 Sets 7.12 Weak Maps and Sets 7.13 Typed Arrays 7.14 Array Buffers Exercises 8 INTERNATIONALIZATION 8.1 The Locale Concept 8.2 Specifying a Locale 8.3 Formatting Numbers 8.4 Localizing Dates and Times 8.4.1 Formatting Date Objects 8.4.2 Ranges 8.4.3 Relative Time 8.4.4 Formatting to Parts 8.5 Collation 8.6 Other Locale-Sensitive String Methods 8.7 Plural Rules and Lists 8.8 Miscellaneous Locale Features Exercises 9 ASYNCHRONOUS PROGRAMMING 9.1 Concurrent Tasks in JavaScript 9.2 Making Promises 9.3 Immediately Settled Promises 9.4 Obtaining Promise Results 9.5 Promise Chaining 9.6 Rejection Handling 9.7 Executing Multiple Promises 9.8 Racing Multiple Promises 9.9 Async Functions 9.10 Async Return Values 9.11 Concurrent Await 9.12 Exceptions in Async Functions Exercises 10 MODULES 10.1 The Module Concept 10.2 ECMAScript Modules 10.3 Default Imports 10.4 Named Imports 10.5 Dynamic Imports 10.6 Exports 10.6.1 Named Exports 10.6.2 The Default Export 10.6.3 Exports Are Variables 10.6.4 Reexporting 10.7 Packaging Modules Exercises 11 METAPROGRAMMING 11.1 Symbols 11.2 Customization with Symbol Properties 11.2.1 Customizing toString 11.2.2 Controlling Type Conversion 11.2.3 Species 11.3 Property Attributes 11.4 Enumerating Properties 11.5 Testing a Single Property 11.6 Protecting Objects 11.7 Creating or Updating Objects 11.8 Accessing and Updating the Prototype 11.9 Cloning Objects 11.10 Function Properties 11.11 Binding Arguments and Invoking Methods 11.12 Proxies 11.13 The Reflect Class 11.14 Proxy Invariants Exercises 12 ITERATORS AND GENERATORS 12.1 Iterable Values 12.2 Implementing an Iterable 12.3 Closeable Iterators 12.4 Generators 12.5 Nested Yield 12.6 Generators as Consumers 12.7 Generators and Asynchronous Processing 12.8 Async Generators and Iterators Exercises 13 AN INTRODUCTION TO TYPESCRIPT 13.1 Type Annotations 13.2 Running TypeScript 13.3 Type Terminology 13.4 Primitive Types 13.5 Composite Types 13.6 Type Inference 13.7 Subtypes 13.7.1 The Substitution Rule 13.7.2 Optional and Excess Properties 13.7.3 Array and Object Type Variance 13.8 Classes 13.8.1 Declaring Classes 13.8.2 The Instance Type of a Class 13.8.3 The Static Type of a Class 13.9 Structural Typing 13.10 Interfaces 13.11 Indexed Properties 13.12 Complex Function Parameters 13.12.1 Optional, Default, and Rest Parameters 13.12.2 Destructuring Parameters 13.12.3 Function Type Variance 13.12.4 Overloads 13.13 Generic Programming 13.13.1 Generic Classes and Types 13.13.2 Generic Functions 13.13.3 Type Bounds 13.13.4 Erasure 13.13.5 Generic Type Variance 13.13.6 Conditional Types 13.13.7 Mapped Types Exercises Index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Similar books