0%

Book Description

Why reinvent the wheel every time you run into a problem with JavaScript? This cookbook is chock-full of code recipes that address common programming tasks as well as techniques for building components and apps that work in any browser. This cookbook provides adaptable code samples that you can easily add to almost any project. You’ll get the job done faster and learn more about JavaScript in the process.

You'll also learn how to take advantage of the latest features in ECMAScript 2015 and beyond, including the new JavaScript data structures, progressive web apps, generator functions, and more. Authors John Paxton, Adam Scott, and Shelley Powers provide recipes to help you use these features to build high-quality application interfaces.

  • Create interactive web and desktop applications
  • Work with JavaScript types, such as strings, numbers, and Booleans
  • Improve your understanding of JavaScript functions, including arrow functions and generators
  • Work with rich media in JavaScript, including audio, video, and SVGs
  • Leverage the latest and greatest JavaScript libraries to rapidly prototype applications
  • Use JavaScript anywhere with Node.js
  • Access and manipulate remote data with REST, GraphQL, and Fetch
  • Fully realize the capabilities of maps, sets, arrays, and iterables
  • Perform asynchronous operations with Promises and async/await

Table of Contents

  1. 1. Errors
    1. 1.1. Using Errors
    2. 1.2. Capturing Errors by their subtypes
    3. 1.3. Throwing useful errors
    4. 1.4. Throwing custom errors
    5. 1.5. Handling JSON parsing errors
  2. 2. Working with HTML
    1. 2.1. Accessing a Given Element and Finding Its Parent and Child Elements
    2. 2.2. Traversing the Results from querySelectorAll() with forEach()
    3. 2.3. Adding Up Values in an HTML Table
    4. 2.4. Problem
    5. 2.5. Finding All Elements That Share an Attribute
    6. 2.6. Accessing All Images in a Page
    7. 2.7. Discovering All Images in Articles Using the Selectors API
    8. 2.8. Setting an Element’s Style Attribute
    9. 2.9. Inserting a New Paragraph
    10. 2.10. Adding Text to a New Paragraph
    11. 2.11. Deleting Rows from an HTML Table
    12. 2.12. Hiding Page Sections
    13. 2.13. Creating Hover-Based Pop-Up Info Windows
    14. 2.14. Validating Form Data
    15. 2.15. Highlighting Form Errors and Accessibly
    16. 2.16. Creating an Accessible Automatically Updated Region
  3. 3. Data Persistence
    1. 3.1. Persisting Information with Cookies
    2. 3.2. Using sessionStorage for Client-Side Storage
    3. 3.3. Creating a localStorage Client-Side Data Storage Item
    4. 3.4. Persisting Larger Chunks of Data on the Client Using IndexedDB
    5. 3.5. Simplifying IndexedDB with a library