Errata

Learning JavaScript Design Patterns

Errata for Learning JavaScript Design Patterns

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page 5. Modern JavaScript Syntax And Features - Modules with Imports and Exports
First code block

In the code example, a named export is mistakenly imported as if it were the default export. To correctly import a named export, one should use curly brackets, as demonstrated below:

```
// Filename: staff.mjs
// =========================================
export const baker = { bake(item) {} };

// Filename: cakeFactory.mjs
// =========================================
import { baker } from "/modules/staff.mjs";
```

Also in the code example, named export of `cakeFactory` was not shown which may cause confusion.

Kinlong Leung  Oct 11, 2023