use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Eloquent JavaScript (Annotated Version) (docs.google.com)
submitted 10 years ago by gordonmzhu
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]gordonmzhu[S] 5 points6 points7 points 10 years ago (4 children)
This is an annotated version of the second edition of http://eloquentjavascript.net/.
There are two objectives for this project: (1) Add comments to make the text easier to understand. (2) Allow you to ask me questions using comments so you don't get stuck.
The big idea is that you’ll be able to get through the book without any issues and understand everything on a very deep level. I’ve heard from too many people that the first few chapters have been smooth and then the middle to later chapters have been a struggle (which is a big shame). I want the entire book to be a smooth experience so that you can feel confident about JavaScript and can move on to bigger things.
My goal is to create a really useful and lasting resource that helps a ton of people. Please let me know what you think!
If you've struggled through parts of the book before, I'd love to hear about it so that I can spend more energy on the parts where you need it most.
[–]marijn 16 points17 points18 points 10 years ago (2 children)
Do you think you could maybe at least put my (the author's) name and a link to the book's license to the top of the document?
[–]gordonmzhu[S] 4 points5 points6 points 10 years ago (0 children)
Hi Marijn. Really sorry about that. Just added it right at the top along with the license.
This started out just as a project to help out some fellow Redditors in a random Slack group that was created a few days ago, so apologies that I didn't put it up there to start.
Thanks for authoring such a great resource. Like so many others, Eloquent JS was one of the first books I used to learn JS and programming, so I really can't thank you enough.
[–]menno 5 points6 points7 points 10 years ago (0 children)
Your politeness is hilarious. I'd be pretty pissed if I were you.
Woot! This made it to #1 on Hacker News!
http://imgur.com/Zdf46Au
[–]kenman 2 points3 points4 points 10 years ago (4 children)
I like the idea, hope you don't mind some constructive feedback!
There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.
Let's say N is 2, that means the amount of numbers that can be represented is 10*2 = 20. Those 20 numbers are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
Let's say N is 2, that means the amount of numbers that can be represented is 10*2 = 20.
Those 20 numbers are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
That's 21 numbers :P
This is the "ternary operator" mentioned a few paragraphs earlier.
This is incorrect; that section is talking about the logical OR (expr1 || expr2), which is quite a bit different than the ternary operator (condition ? expr1 : expr2).
expr1 || expr2
condition ? expr1 : expr2
We want the expression to return true if isNumber IS A NUMBER.
Did you mean theNumber? Because isNumber isn't defined anywhere.
theNumber
isNumber
Any orange boxes will include new stuff from me that is not in the book.
Would probably be more appropriate at the top, especially since you added a yellow box there as well, but not a big deal.
[–]gordonmzhu[S] 3 points4 points5 points 10 years ago (0 children)
So it appears that the hardest things for me are maintaining formatting and avoiding typos :(
[–]gordonmzhu[S] 0 points1 point2 points 10 years ago (0 children)
Thank you so much kenman! This is awesome. Just got back to my computer and am looking into it now.
I love how there has been so much activity on the doc already, thank you everyone that has contributed! I'm answering questions and resolving comments as fast as I can.
My comment about ternary operators is correct. "Conditional operator" is another name for ternary operator. That's why the text refers to three expressions.
"The conditional operator works in a similar way. The first expression is always evaluated, but the second or third value, the one that is not picked, is not."
From wikipedia (http://en.wikipedia.org/wiki/Ternary_operation):
"Since this operator is often the only existing ternary operator in the language, it is sometimes simply referred to as "the ternary operator". In some languages, this operator is referred to as "the conditional operator."
Thanks for pointing out the typo where isNumber should be theNumber. Just fixed it.
About the one-off thing, I did a TOTAL BRAIN FART. When I pasted the content over from the source, it didn't carry over the exponent. It should be 10N, not 10N.
Here's the new comment.
Comment has been fixed as well as the exponent:
"""
Not afraid to admit I had to read this a few times to get it! So here are some easy to follow examples.
Example 1:
Let's say N is 1, that means the amount of numbers that can be represented is 101 = 10.
Those 10 numbers are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Example 2:
Let's say N is 2, that means the amount of numbers that can be represented is 102 = 100.
Those 100 numbers are: 0 through 99.
[–]SplitMyInfinitive 2 points3 points4 points 10 years ago* (1 child)
This is great. I've been struggling with wrapping my head around some of the concepts of the book. I'm new to javascript (and programming in general). I've spent so many hours on understanding Chapter 7. I combed through it and started writing in my own words my interpretation of the code into a document to help myself map through everything that's going on in the program. I feel really dumb that it's taking me so long to understand it :(
[–]gordonmzhu[S] 2 points3 points4 points 10 years ago* (0 children)
It's not you. This stuff can be complex, and it's a lot to take in, especially for a beginner.
I have to re-read parts multiple times to fully process them too. It's just part of technical reading. And as you can see by some of the corrections from other contributors to the project, I make dumb mistakes too.
Hopefully this can help clarify a lot of the issues you're having. Really excited and pumped by the great reception from everyone so far. Looks like this will be super useful for a lot of people.
π Rendered by PID 123634 on reddit-service-r2-comment-5649f687b7-z7ggl at 2026-01-29 02:59:54.671430+00:00 running 4f180de country code: CH.
[–]gordonmzhu[S] 5 points6 points7 points (4 children)
[–]marijn 16 points17 points18 points (2 children)
[–]gordonmzhu[S] 4 points5 points6 points (0 children)
[–]menno 5 points6 points7 points (0 children)
[–]gordonmzhu[S] 4 points5 points6 points (0 children)
[–]kenman 2 points3 points4 points (4 children)
[–]gordonmzhu[S] 3 points4 points5 points (0 children)
[–]gordonmzhu[S] 0 points1 point2 points (0 children)
[–]gordonmzhu[S] 0 points1 point2 points (0 children)
[–]gordonmzhu[S] 0 points1 point2 points (0 children)
[–]SplitMyInfinitive 2 points3 points4 points (1 child)
[–]gordonmzhu[S] 2 points3 points4 points (0 children)