getify / You-Dont-Know-JS

A book series on JavaScript. @YDKJS on twitter.
Other
179.24k stars 33.48k forks source link

`add10To` vs `addTo10` #1855

Closed Violet-Bora-Lee closed 9 months ago

Violet-Bora-Lee commented 9 months ago

Yes, I promise I've read the Contributions Guidelines (please feel free to remove this line).


Please type "I already searched for this issue": I already searched for this issue

Edition: 2nd

Book Title: Scope and Closures

Chapter: 7

Section Title: An Alternative Perspective

Problem:

Hello, my name is Bora Lee, and I am currently finalizing the translation work for a Korean text. I'm reaching out because I've noticed some discrepancies between the code, the text, and the images.

function adder(num1) {
    return function addTo(num2){
        return num1 + num2;
    };
}

var add10To = adder(10);
var add42To = adder(42);

add10To(15);    // 25 
add42To(9);     // 51 

In the code, the instances created by the inner function calls are named add10To and add42To, but in the accompanying images and descriptions, they are referred to as addTo10 and addTo42. I'm contacting you to clarify this as I might be misunderstanding something. Could you please confirm if the text and images provided are correct?

image

image

getify commented 9 months ago

It's a minor typo discrepancy. The code snippet should use names that match the images and surrounding text.

Violet-Bora-Lee commented 9 months ago

Ah, I see. I personally find add10To(15) more intuitive and to my liking, but I will convey your words to the publisher as well.

Thank you for your prompt response, especially during the holiday season. 🎄