Hacker News new | past | comments | ask | show | jobs | submit login
Eloquent JavaScript, Second Edition (eloquentjavascript.net)
632 points by ingve on July 30, 2014 | hide | past | favorite | 107 comments



In regards to the book's online version, I like how it has code examples that one can edit and run inline among the book's text. I often find myself, while reading a book on a particular language, opening up a new project in an IDE or a REPL in order to fiddle around with what the book it trying to teach. This makes it much more fluid.

It was a pleasant surprise. It is a nice concept I have not previously seen done. (I'm sure someone can come up with examples of where it has previously been done before but this is the first I personally have seen it.)


I just wish we had hi-res, color, e-ink monitors with quick refresh rate. I can't bring myself to read an entire book online; even if it's free.


I agree completely. I would love to be able to sit outside and code on my laptop, but the glossy Macbook air screen makes this almost impossible. I would pay good money for a barebones, development only laptop with an e-ink monitor.

For what it's worth, some people have hacked around with the Kindle to try to make this a reality, but as you say, the refresh rate is the bottleneck. [1]

[1] http://www.ponnuki.net/2012/09/kindleberry-pi/


Me too. I would like to replace my older business notebook (mate display, good colors) with a MacBook but Apple only ships glossy displays nowadays :(

I hate the eye-strain that the iPad causes when I use it outside in nature. Sometimes I go back to my Kindle, but it is too slow and too small for my complex PDFs.


Currently the biggest ebook reader is the Sony 13.3 incher but it is hard to obtain and quite expensive: http://the-digital-reader.com/2014/03/27/sonys-13-3-ereader-...


Thanks for the hint. Maybe I should buy that one, before Sony stops producing eBook readers.

On February 6, 2014, Sony announced that it is closing its North American Reader Store in late March, migrating all its customers to the Kobo Reader Store.

-- http://en.wikipedia.org/wiki/Sony_Reader#Models_and_availabi...


For me, it depends on the type of book. I find I can bare reading a technical book online. However, I have trouble reading it for very long, I find myself skipping prose to get to the meat of the content, and I find a quick glance at my email or F5 on my favorite news site is just a small click away. Still, I personally find reading technical books easier on the computer while reading a novel or biography far better with a cup of coffee, an easy chair, and an e-reader.


The other thing I find with reading technical books on a computer is that it's a different experience - I'm constantly flipping over to an editor/REPL to try things out, so it's not like I'm staring at a wall of text for hours on end.


If a book isn't technical, I can usually read it in audio format as I do something otherwise mindless like washing dishes, so most of what I need to read (with my eyes) contains equations, code listings (like this JavaScript book), diagrams, maps, etc., that don't work well at all on today's e-ink displays: Thousand-page "Introduction to..." technical books, code listings, foreign-language tutorial textbooks, journal articles, etc.

Unfortunately, all the books I really want to read with my eyes are too heavy to tote around or take on plane trips, which is almost the only time I have time to read them.

I need a REALLY GOOD reader. I wish I had a lightweight, clipboard-sized, hi-rez, B&W, PDF reader with the flick scrolling, pinch resizing, etc. of an iPad with the battery life to last a whole delayed flight from San Francisco->Tokyo->Singapore, door to door. I might be able to make do with a jumbo tablet if the USB ports that some airlines now put in the seats can power it.


> I need a REALLY GOOD reader. I wish I had a lightweight, clipboard-sized, hi-rez, B&W, PDF reader with the flick scrolling, pinch resizing, etc. of an iPad with the battery life to last a whole delayed flight from San Francisco->Tokyo->Singapore, door to door.

Have you seen the Sony Digital Paper System[0]? It seems to fit the bill perfectly but the price point high.

[0]: http://pro.sony.com/bbsc/ssr/product-DPTS1/?PID=I:digitalpap...


+1 for this interesting suggestion. Thanks. I've never heard of it and would love to try one.

Apparently, it doesn't scroll, but I'm sure scrolling takes a lot of energy to do all the refreshes. I assume that a large, hi-rez reader can offer scrolling, thinness/lightness, or long battery life, pick two.


I hear you.

I tried a lot of options before just settling on an ipad for a reader when it comes to anything that resembles a technical manual or text book.

I'd be interested in knowing if anyone has any other better suggestions, as far as that goes.

I guess you could go the route of bringing an external lithium ion battery w/ usb charger cord, but those are always kind of kludgy


I had same reasons that you mentioned so I recently ordered kindle paper white. I am not sure if it will fit the bill otherwise I will return it.

Big plus that kindle have over others is e-ink that will make it easy on eyes. It is hard to read (and not good for eyes) on other devices for long.


Well, we do have retina ipads (and other tablets).

e-ink I find just a gimmick -- there is no scientific research that shows it being any better than a typical monitor for the eyes (Amazon also retracted such statements IIRC). The only real benefit was resolution (which retina/hi-dpi solved) and reading in the sun (which e-ink retains as an advantage).

Sure, one reflects light and the other has a light source embedded. But a photon is a photon in both cases (and you can blind yourself with a white paper too, if you hold it at the right angle to the sun) -- and you can set the tablet display at the desired, equivalent to reflectef light, brightness.


It may be gimmicky to you, but I cannot read an entire book in a sitting or two (as I often do) on any kind of non e-ink monitor and that includes tablets. I can easily do this on a Kindle or other e-ink device. So, for me, e-ink is no gimmick, it is an essential requirement for prolonged reading.


Well, FWIW, I for one can read a whole books, actually lots of them from both iBooks and iOS's Kindle app (read on a tablet. Heck, even on an iPhone). And don't care particularly for e-ink (I also have a kindle I don't use much).

If you can find some specific scientific argument why e-ink is "an essential requirement" (besides personal choice) then it's just cargo cult.

I listed fairly accurately were e-ink is better, namely reading in sunlight. And battery life, which I forgot.

For reading inside, it's advantages of yore, like resolution have been matched by hi-dpi screens. The only other advantage is better default contrast, which is a configurable setting on a tablet.


> If you can find some specific scientific argument why e-ink is "an essential requirement" (besides personal choice) then it's just cargo cult.

That's not how science works, and your comments are abrasive and offensive for no good reason. Things exist before scientists can prove them, and that's why research is done.

Although a quick Google search led me to find a paper backing your argument, I find you way too quick to dismiss other readers as doing "cargo cult". Why not believe them when they say they feel less strain?


>That's not how science works, and your comments are abrasive and offensive for no good reason. Things exist before scientists can prove them, and that's why research is done.

Research WAS done though. And didn't find much in advantage.

>Why not believe them when they say they feel less strain?

Because that's not how science works either. Subjective feelings are a dime a dozen. Users of homeopathic "drugs" also "feel less strain" but they're just drinking water. People can be led to believe (and "feel") anything by marketing, religion, snake oil merchants, etc.


Off the top of my head there are 2 major differences between e-ink and non e-ink displays that could potentially explain differences in comfort level for prolonged use:

- Non e-ink displays have a refresh rate, therefore continuous "activity" on the screen. People can have different sensitivities to this.

- Non e-ink displays tend to have higher contrast and/or brightness. This would normally be considered an advantage, but again perhaps not for prolonged use.

I don't need scientific papers to tell me I find e-ink more comfortable or not, it becomes very quickly apparent when I try to read a book on a tablet. Obviously you have a different perception, that does not invalidate mine.


I am not sure if either of the two effects you listed are behind this. I think the most notable issues include:

1. Less brightness as measured in nits. Emmissive displays are often tuned to much higher brightness than normal objects around us including reflective displays like E-ink.

2. Reflective displays and paper often have significantly lower front-surface reflection than LCDs/OLED displays. Add touch-screen and it gets ruined beyond repairs.

The first one is easy to tune by reducing brightness levels. However (A) that makes the second one worse as the brightness of the displayed content reduces but the brightness of reflection does not, and (B) displays are often too bright even at their lowest brightness levels allowed. Put a white paper in the front of white background on the screen, and you'll see what I mean.


>I don't need scientific papers to tell me I find e-ink more comfortable or not, it becomes very quickly apparent when I try to read a book on a tablet.

Well, without science to back it up, it's mostly good ole superstition. Subjective feeling doesn't say much (that's why placebo work too). The same things ("I don't need science to back this up, I know I feel better with it") are also said for "magnetic bracelets", homeopathy, and tons of similar things.


Use of the term "cargo cult" is cargo cult.


Nice try, but no.

The word has a defined meaning/usage.

Taking marketing claims for technical superiorit with regards to readability as gospel without any scientific evidence of their validity (and even evidence to them being nothing much) qualifies.


You would be right, but my visual cortex actually has an elisp hook that trims marketing text and imagery. So, in this case, my comment was borne out of purely personal, first-hand experience. Furthermore, my original comment's 'wish' was not an attempt to apply opinion-constraints upon others. My aim was to garner karma from individuals who might share the same sentiment as I.


>Furthermore, my original comment's 'wish' was not an attempt to apply opinion-constraints upon others.

You say it like it's a bad thing.

Isn't trying to get people to agree to some objective/scientific fact an attempt to "apply opinion-constraints"?

As long as there is no violence or legal restrictions involved (e.g you don't force anyone by anything else than your arguments) then I'm all for applying opinion constaints on that nature.


Reflexes on displays are tiring, some people even get headaches from that. I don't know any tablet with non-reflective display but e-ink readers.


The battery life on devices with e-ink lasts significantly longer.


Completely agree! I can't finish books in one sitting on my laptop (my eyes get tired quickly), but it is easy on my Kindle paperwhite.


the thing I really liked about my ereader was the battery life and the size/weight of it. I don't think it weighed as much as my iphone, even. But really, the battery life was the biggest thing.

When I was on a cruise, I read something like four or five books on it and only got halfway through the battery life. I could have plugged it in at night, but it's nice to be able to just forget about it.

Ereaders are also a great option when you're hiking/camping. If I ever go back on the appalachian trail, I'm def bringing an ereader with me.

Anecdotally, they feel more comfortable to me to read long books, but that's really just comparing it to an ipad, which is way heavier, and part of that is probably subconsciously buying into the old info on eye strain.


Even if there's no scientific research, e-ink doesn't seem a gimmick to me. I find it a pain to read on a laptop, but find a kindle almost as good as a real book. My eyes simply tire a lot faster with an LCD.


As I said, laptops don't have the e-ink resolution. And depending on what you read, it might not even have the same contrast.

So, unless you adjust the brightness and contrast appropriately and have a hi-DPI laptop, e-ink will come on top for reading. There's also the convenience in holding the reader vs using the laptop to read.

So cannot really compare it to a common laptop. To actually compare like to like, compare an e-ink reader with a hi-dpi ("retina") tablet, with the brightness/contrast configured appropriately.


I don't think it's about resolution. I'm comparing a 15'' 1920x1080 laptop screen to my 2nd Gen Kindle. I think it's about brightness. Light-emitting screens make it harder on the eyes to read books. An iPad's screen feels similarly uncomfortable to me. The main benefit of e-ink is that it doesn't emit light and therefore feels almost like a paper book.

Agreed about the ergonomics: it's more comfortable to hold a kindle than a laptop. However, I'm not sure I could replicate the experience with a tablet: I'd have to lower brightness a lot, increase contrast, and shine a light on it, at which point LCDs stop being comfortable to read.


While I totally agree that brightness is a very important factor, there is another very significant one, front surface reflection. See more in my comment here: https://news.ycombinator.com/item?id=8124039

However, in my experience, resolution matters too. I increased the font-size on my monitor and saw a clear impact on readability.


> photon is a photon in both cases

With backlit LCDs you are getting fluorescent light, whereas with e-ink you can choose to have reflected daylight or incandescent ... i.e. broad spectrum sources. Definitely different on my eyes.

It's the refresh rate / responsiveness that kills the experience.


If you like Python, check out How To Think Like A Computer Scientist (http://interactivepython.org). It's aimed at introductory CS classes, but the inline interactivity is pretty cool! (Shameless plug: a couple of my professors developed this, and I spent last summer contributing to it).


For those who don't like Python, and want to think like a real computer scientist check out Interactive SICP (http://xuanji.appspot.com/isicp/) It is also aimed at introductory CS classes.


Linked resource is first rate; tone of comment not so much.


this is theses other forks which can be nicer on mobile: - html: http://sarabander.github.io/sicp/ - epub/pdf in the repo: https://github.com/sarabander/sicp


Holy Christ, I had no idea this existed. Awesome.


That's neat, generally I like physical books better but that really shows the potential of ebooks. I've been working on something similar for the JavaScript/browser APIs (http://www.javascripture.com) since I learn a lot better when running code myself.


Good read. After you finish this book I'd suggest the free Javascript Allonge https://leanpub.com/javascript-allonge/read An excellent intermediate/advanced javascript book.


Seconded.

I'm currently using it as a beginners Javascript book and find it extremely accessible.


We'll speak to you again once you're beyond chapter 5...

(absolutely loved it as well by the way)


I've been following this book for a while now and I'm pretty thrilled to see its reception here on HN. This book is an excellent introduction to front-end development (and even a little backend since it does include a chapter on Node.js)

It has an excellent balance of design patterns and introductory knowledge to attract the new and also seasoned developers who are beginning to look at javascript more seriously.

(This book is also a great primer for anyone who did not understand Javascript the Good Parts)


Any idea if this book would be a waste of time if the good parts sunk in easily?


This was a great reference when I started learning JavaScript. It just didn't go over the language, but also gave a great history of programming in general and why JavaScript is structured how it is. A lot has changed in JS land since the first version came out so I look forward to have the author tackles it/


Agreed. This book's conversational style and carefully-worded explanations of core concepts from multiple paradigms helped me begin to grok javascript beyond just $('.that-thing-there').doStuff();


This is the best Javascript tutorial out there, and I was eagerly looking forward to this update. From glancing at the text, however, it seems that it doesn't cover the very significant upgrades introduced by ECMAScript 6 "Harmony".

Seeing that the standard is already being finalized towards a release in 4 months[1], this seems like an unfortunate omission in an otherwise top-notch text.

[1] http://en.wikipedia.org/wiki/ECMAScript#ECMAScript_Harmony_....


I considered (and actually started writing) an extra chapter on ES6, but the current state of the standard is poorly documented and still in flux. Also, it's a huge standard, so it'd have taken two or three chapters at least to cover it properly.

For something that won't be supported for a while yet (without using a transpiler), that seemed too much bother. I might add such chapters in the future.


Isn't it already supported in NodeJS (there is a --harmony flag)?


There are some features that are supported, but there's a long way to go before V8 supports the whole standard.



That is unfortunate. I do hope the ES author updates his text to ES6 to encourage newbies to make use of the many new features, though it's understandable he chose to refrain from it for now.


And based on their past performance quite likely to be later than that date as well. I would expect it done by ~2020.


Kind of a cheap shot, don't you think? Standards and browser adoption are two completely different things. It will be years before anyone tries using ES6 features in JavaScript and expects most browsers to understand them.


It wasn't my goal to take a shot at Eloquent Javascript. As I said, it's my first recommendation to any newbie learning Javascript, and an absolutely top-notch text.

> It will be years before anyone tries using ES6 features in > JavaScript and expects most browsers to understand them.

I dispute that. Many ES.next features are already implemented in popular browsers[1].

[1] http://kangax.github.io/compat-table/es6/


Inspite of all the criticism that Javascript gets it's so easy to just dive in and start messing around. The game projects seem like a lot of fun.


Great book but... is it finished yet? Doesn't seem so [1].

[1] https://github.com/marijnh/Eloquent-JavaScript


According to Marijn Haverbeke's twitter feed[0]:

"I am happy to announce that the online edition of Eloquent JavaScript's 2nd edition is done, and online at " http://eloquentjavascript.net

[0] https://twitter.com/marijnjh/status/494433950505644032


It more or less is, apart from some further proofreading. I forgot to update the README file.


Reading through the first few chapters I found a couple of words with double brackets round them (( )) that look like they should just have been italics (or maybe links to another section?).


Those were index terms that weren't properly parsed by asciidoc. Should be better now.


The original version is one of the readings that I suggest for experienced engineers on our team who are new to working with JavaScript.


I am both quite happy and a little sad that the chapter on functional programming was nixed from the first edition.

It was way over the heads of the beginners the book was aimed at, but it sure was fun to try and figure out.


Is that stuff in the chapter called higher order functions now?

http://eloquentjavascript.net/05_higher_order.html


From my quick skim checking to see if it was still there, no. He touches on some of the same points, but it's not nearly as in-depth or crazy (in a wonderful, functional way).


After looking at the old chapter again (http://eloquentjavascript.net/1st_edition/chapter6.html), it isn't as intimidating as before. So yeah, maybe it is still mostly all there -- it seems the ES5 syntax makes it way less confusing


As I understand audience of the book is both experienced programmers and who hasn't done programming before. Can anyone please comment if it will be boring for experienced programmers (who are new to javascript) or not?


The first few chapters will probably be a bit slow. But it ramps up pretty quickly around chapter 5.


I've been wanting to read this. Sweet: https://gist.github.com/g-P/cbdfd4a4b982ba8fa04b


The github page for the book has a makefile that creates a pdf of the book.

The book was written for both computer and pdf, so you should really build the PDF from the code to get the parts of the text that have been altered for print. If you just PDF the html, you end up with some weird things from the interactive parts.

You can find the build targets here: https://github.com/marijnh/Eloquent-JavaScript/blob/master/M...


Attempted to make a PDF from the makefile. I don't have some of the fonts needed - am I out of luck?


Yes, it's currently trying to build the pdf with the No Starch house style, which contains commercial fonts. Setting up a plain-LaTeX build for the pdf is near the top of my list of things to do (but I'm taking a holiday first).


I want to learn decent amount of HTML/CSS/JS to beautify and improve the usability of my webpage. What would be a good source to learn these things?


When I started this about 8 years ago or so, i used [this book](http://www.headfirstlabs.com/books/hfhtml/). It's structured as a case study, a coffee shop owner who wants to make a small webpage.

It's amazing how it's well written and fun to read. I like it puts some effort in showing you quickly the benefit of what you learned, you never get the impression something is pointless. (NB: it's big but you don't have to read it all. I read say the first half, than used it more like a reference book.)


Looking forward to reading it. Is there a place to report bugs I noticed a type in the first chapter

"Casual computing has become become much "


github link given later - may be report bug there, or just send a pull request : https://github.com/marijnh/Eloquent-JavaScript


Why is the paper book delayed until november? also the paper book says it has 400 pages, does the paper book has more content?


It'll have a single bonus chapter. But the current text, as it is online, already takes up 390 pages when typeset in No Starch's house style.


Will you consider accepting donations on your site?


Yes, that's something I planned but haven't gotten around to yet. (Not very clever to leave it after the big announcement, I suppose.)


Book will have much larger font


Excellent. I've been awaiting this one. I'm at the perfect sweet spot to make maximum use of it.

And I do love good writing...


Question to author: Why did you choose CC-BY-NC when you also make your contents available under MIT licence?


Always wanted to take the time to complete this book. Looking forward to diving into the 2nd edition.


This is a bit off topic but does someone know how this book is generated, which tools are used?


An unholy chain of asciidoc and node scripts. The sources are at https://github.com/marijnh/Eloquent-JavaScript


Thanks! I had no idea something like asciidoc existed. It seems to be a fair balance between markdown and tex


Would anyone recommend this after already going through the good parts by Douglas Crockford?


Mobi or epub version anyone?


There will be one. I haven't gotten around to all the fiddly parts involved in producing a good-looking ebook yet.


The sources (https://github.com/marijnh/Eloquent-JavaScript) are written in ASCIIdoc which has an epub export. So it should be easy to build one yourself.


CLick on the link to purchase, you can buy a mobi or epub version, or a bundle with the printed book (not ready yet)


doesn't lool like mobi is ready yet.


Should I buy/read the second edition when I already own the first one?


Only if you feel you want to go over that material again, in a more up-to-date format, and with better/more example projects. If you've already mastered JS and web development, the new edition probably won't teach you anything new.


I thoroughly enjoyed the first edition, looking forward to this.


blah


"These ideas were initially worked out in the 1970s and 80s, and, in the 90s, were carried up by a huge wave of hype—the object-oriented programming revolution. Suddenly, there was a large tribe of people declaring that objects were the right way to program, and that anything that did not involve objects was outdated nonsense.

That kind of zealotry always produces a lot of impractical silliness, and there has been a sort of counter-revolution since then. In some circles, objects have a rather bad reputation nowadays."

Eloquent JS, maybe, eloquent writing. Not in this book.


I can't say I expect a book about writing computer code to be Hemingway. What's the point of this criticism? The writing is clear, concise, and does exactly what it's intended to do.

Additionally, your last line has the worst punctuation of all time.


This book contains some of the best writing I've seen since beginning my study of CS.

And you might at least use correct punctuation when critiquing someone else's writing.


I disagree. The writing is excellent: pragmatic and insightful at the same time. In fact, your quote is a great example of its high quality. I don't need, nor do I like, the heavy handed style of some authors. Eloquent JS is eloquent both in its writing, and in the fact that it elevates javascript.


Note the author is not a native English speaker, and the book in its current form probably hasn't gone through the editors yet.



This book needs some serious editing. There is clunky English which native speakers can figure out the gist of it but English as a second or later language would have a problem with. There are parts where I wonder why certain terminology is not explained before using it and other areas where terminology is explained that I assume the reader needed to know before reading this material. Good technical books have a section in the beginning usually called something like "Intended audience" or "Who should read this book". I only did editing for a few years but those are the first things I noticed after reading the intro and chapters 1-3.


Could you be more specific about the problems you found? The first few chapters of the book have been edited by three professional editors at this point.


(Clarification: actually, that goes for the first 4 real chapters. The intro chapter might still be a little rough.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: