The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

xboxremote (6) [Avatar] Offline
#1
On Listings 4.8 and 4.9, it talks about exporting an "addTwo" function that takes a number and adds two to it. In Listing 4.9, the code passes the number 4 as an argument to the function, but the comment immediately after says it returns 4. It should return 6:

4.8 (basic-math.js):

exports.addTwo = n => n+2;


4.9:

const basicMath = require('./basic-math');

basicMath.addTwo(4); // returns 4


4.9 should be:

const basicMath = require('./basic-math');

basicMath.addTwo(4); // returns 6
Steve Kinney (33) [Avatar] Offline
#2
Thank you so, so much! You're totally right. I've fixed this in the manuscript.
xboxremote (6) [Avatar] Offline
#3
Steve Kinney wrote:Thank you so, so much! You're totally right. I've fixed this in the manuscript.


No worries!

- Nick