Monday 31 December 2018

Unreported Error in "Testable Javascript"?

I'm working through the O'Reilly book "Testable Javascript" by Mark Ethan Trostler. I found something that doesn't make sense to me, but it is not called out in the errata for the book. What I'm looking at is on page 71, and other code from that page is noted in the errata, but the smaller snippet I'm concerned with is not. Here it is:var BD = function(dbHandle) { this.handle = dbHandle; } DB.prototype.addUser = function(user) { var result = dbHandle.addRow('user', user); return { success: result.success , message: result.message , user: user }; }; My question is, on the second line of the second block, wouldn't you have to use the instance specific database handler object such that the line should read: var result = this.handle.addRow('user', user); ??????

Submitted December 31, 2018 at 03:27PM by SoPoOneO

No comments:

Post a Comment