Errata: 1st Edition

Chapter 14, page 289, in the section Promise-ifying the other DataStore methods

The last code listing on the page shows what code to remove from DataStore.prototype.add.

The line this.data[key] = val; should not be removed.

The final version of DataStore.prototype.add should be as follows:

DataStore.prototype.add = function (key, val) {
  this.data[key] = val;
  return promiseResolvedWith(null);
};
1 Like