printOrders method error

I have a mostly conceptual question. So in this chapter, we switch out the datastore.js for remotedatastore.js essentially. Instead of passing an instance of DataStore to Truck’s constructor, we pass in an instance of RemoteDataStore.

The book stresses that this should work seamlessly (mostly), because the functions in both scripts take the same parameters. However, I’m very confused by this because the RemoteDataStore getAll method takes in a function as a parameter, while the DataStore getAll method takes no parameters.

Thus, when I try to call myTruck.printOrders() from the console, it errors because there is no function being passed into the RemoteDataStore getAll method. Did the book forget to address this minor detail, or am I missing something in the bigger picture?

Thanks,
Travis

Hi @travpav84, nope this one’s on us! Check the Errata postings o’er here: Errata: 1st Edition

@nybblr, I don’t think those errata answer the question from @travpav84.

The printOrders() method in the Truck class calls this.db.getAll(), and note there is no argument passed for the function parameter cb of getAll(cb). Therefore, when the getAll(cb) executes, it runs into problems when it attempts to call the resulting undefined function cb.

And the same thing happens with the call to this.db.get().