11 ms·
Eloquent JavaScript 4th edition (2024)
- richrichie 3y ago> Every now and then, someone comes up with a new way to circumvent the limitations of a browser and do something harmful, ranging from leaking minor private information to taking over the whole machine that the browser runs on. The browser developers respond by fixing the hole, and all is well again—until the next problem is discovered, and hopefully publicized, rather than secretly exploited by some government agency or criminal organisation. This is from the chapter on HTML and JS (emphasis mine). It is funny to see how govt agencies and criminal organisations are mentioned in the same breath. How did we end up here?
- tracker1 3y agoLike that this now includes a chapter on Node. I think it would be nice to see a follow-up book in a similar style that covers a bit more with Node, Deno and Bun. I really like the Deno approach so far. I prefer TS mostly these days as well as the esm stroke modules. I think node just made usage harder in their approach. I understand why, I still disagree on the solution.
- ArcMex 3y agoIn my interactions with Marijn, he’s been very responsive. I’m happy to see this release and wish him continued success. I learned JS from the second edition. Incredible resource.
- isquaredr 3y agoAny suggestions from the community on the best way to consume this site as an audio book? I know I could scrape and feed into a text-to-speech library but was wondering: is there is anything off-the-shelf?
- boringuser2 3y agoThis book took me from having nothing -- literally being a political science major grocery store employee -- to making 2xx,xxx YOY. It was challenging and made me question whether or not I had it in me to code. Turns out, I could, and, vis-a-vis my peers, exceptionally well. Well, I took me, but this book was my first real introduction to computer science. Funnily enough, I didn't then and don't now personally care for the author (he seems untalented as a teacher), but I feel he accidentally made a good resource in his hubris.
- marijn 3y agoYou're welcome
- boringuser2 3y agoThumbs up emoji.
- mixmastamyk 3y agoWhere are you making $200k+ with limited experience and do you need a senior partner? :-D
- boringuser2 3y ago6 years is sufficient experience, and we're good, thanks!
- mixmastamyk 3y agoIt’s enough to do well, but certain we all grow for quite a while after that. The improvement typically springs from discipline at that point rather than calculative ability however.
- boringuser2 3y agoI'm not entirely convinced. I've seen interns that are better than some of my 15+ year colleagues. I'm better than most of them myself, but I've also seen interns better than me -- better problem solving skills and attention to detail I suppose. Very inconsistent correlation in terms of time spent outside of filtering people. Of course, you used to have a knowledge advantage that would hold for a bit, but intelligent usage of GPT-4 removes even that. I'm pretty sure the whole enterprise is a combination of being gifted intellectually, with maybe a sprinkle of actual effort and abilify to sustain your attention on supremely boring tasks -- but mostly just your innate gifts at work. When I say "better than"... well, here's my opinion: In programming, someone more talented can be up to 10x more productive at each tier of competence, shall we say. My least productive (senior and junior) colleagues are 10-100x less productive than me. My most productive colleagues (senior and junior) are probably 10x more productive than me. This is an interesting discussion to me because I used to believe the whole tiered conception of programming knowledge until I learned that this wasn't the case through experience. It's all just problem solving, and you're either smarter or less smart and you can't change this with even 1000 years of study.
- noname120 3y agoMy go-to JavaScript book will always remain “JavaScript for impatient programmers”[1], a 639-page book written by Dr. Axel, PhD. It's quite complete and detailed. But as if it wasn't enough the author wrote a second (smaller book) named “Deep JavaScript: Theory and techniques”[2]. Both are free to read online! [1] https://exploringjs.com/impatient-js/ https://exploringjs.com/impatient-js/ [2] https://exploringjs.com/deep-js/index.html https://exploringjs.com/deep-js/index.html
- jrvarela56 3y agoI love the web version has a feature to link back to any given paragraph. I hadn't noticed this in any other site and found it delightful.
- giovannrobin 3y ago[dead]
- DarkNova6 3y ago[flagged]
- msoad 3y agoThis is the book that helped me really understand JavaScript. Really great content and I can't thank Marjin enough for putting this out there for free. Also how this person is so productive? I really would love to read on how he manages his time and priorities.
- deleted 3y ago[deleted]
- Quothling 3y ago[flagged]
- deleted 3y ago[deleted]
- dcre 3y agoThis is my favorite book about JS, and I always recommend it to people. It occurs to me for the first time that the lack of TypeScript might be a problem, because if I’m making recommendations to someone learning, I am definitely going to recommend they write TS instead of JS. On the other hand it may actually be helpful to learn the concepts in this book without the additional syntax overhead of type annotations, plus the more webby content doesn’t really have much to do with types anyway.
- OmarShehata 3y agoI very much concur that it is better NOT to introduce TS when explaining JS fundamentals. I've seen smart engineers with a C++ background get tripped up on and very confused working with TS, because it's not clear to them what concepts are "language fundamentals" and what concepts are "the TS transpiler". (Like expecting that just because you declared something as type X, that it guarantees at runtime it will always be type X, but it won't. You may get data from an API that _says_ it returns type X but the contents don't match. That can be valid code that compiles and has weird runtime behavior)
- lost_womble 3y agoAgree. I wish tools like zod/valibot were first class in typescript.
- epolanski 3y agoAlso effect schema if you're looking for something much more powerful and in effect-land.
- ayuhito 3y agoI wholeheartedly agree. At most, I introduce JSDoc[1] to newer developers as standardising how parameters and whatnot are commented at least gets you better documentation and some safety without adding any TS knowledge overhead. [1] https://jsdoc.app/ https://jsdoc.app/
- DarkNova6 3y ago
- llmzero 3y agoWhat's new in this edition?
- begueradj 3y agoIt should be mentioned in the "Introduction" but it seems your question is not covered there.
- e12e 3y agoCould've used better commit messages, but: https://github.com/marijnh/Eloquent-JavaScript/compare/3rd_edition...master https://github.com/marijnh/Eloquent-JavaScript/compare/3rd_e...
- deleted 3y ago[deleted]
- llimllib 3y agoyou can see the differences on github: https://github.com/marijnh/Eloquent-JavaScript/compare/3rd_edition...master https://github.com/marijnh/Eloquent-JavaScript/compare/3rd_e... From a quick browse: - # for private properties - ESM imports in node - hasOwnProperty -> hasOwn (TIL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...) - Math.pow -> ** - coverage of `function*` generators (https://eloquentjavascript.net/11_async.html#h-o+cFzGGhnz https://eloquentjavascript.net/11_async.html#h-o+cFzGGhnz)
- bewuethr 3y agoHere's a diff without the first commit that changed all linebreaks: https://github.com/marijnh/Eloquent-JavaScript/compare/d829015113c08c5a2180b614992d6c41e14f6a0f...08cfb2a28d4d6576858e4432eb709a72e34f1c50 https://github.com/marijnh/Eloquent-JavaScript/compare/d8290...
- greenie_beans 3y agothis book taught me javascript! great book, highly recommend it.
- begueradj 3y agoI agree. Have you also read "JavaScript: The Good Parts" ?
- ramesh31 3y agoAs others have stated, The Good Parts is no longer something I'd reccommend. It's more or less the K&R of JavaScript at this point. An interesting historical primer, but it would only serve to confuse a newcomer today, as all of the warts in the language discussed are ancient obsolete history.
- greenie_beans 3y agonope, looks like a deep cut and will fill in some knowledge gaps i have. thanks for the rec. another good one for my learning was "secrets of the javascript ninja"
- regus 3y agoSecrets of the Javascript Ninja is my favorite JS book by far.
- davidroetzel 3y ago"JavaScript: The Good Parts" was a great and a very important book back in the day. I am sure it inspired many of the improvements JavaScript has seen since then. But as it has seen these improvements, and as they were many indeed, I am not sure the book is still as relevant as it once was. Or to put it differently: There are many more good parts to JS these days compared to when the book was released :)
- svat 3y agoI love this book, even since its first edition. It's very clear even on elementary stuff, e.g. see the section on bindings/variables: https://eloquentjavascript.net/02_program_structure.html#h-lnOC+GBEtu https://eloquentjavascript.net/02_program_structure.html#h-l... — avoids the pitfall of thinking of variables as “boxes”. I was trying to find what's new in the 4th edition, and following links from the author's website https://marijnhaverbeke.nl/ https://marijnhaverbeke.nl/ found this on Mastodon (https://mastodon.social/@marijn/112020092273623390 https://mastodon.social/@marijn/112020092273623390): > The FOURTH EDITION of Eloquent JavaScript is now online, adjusted to the realities of 2024 and generally touched up.
- shippintoboston 3y ago[dead]
- DenverSWE 3y agoLooks as if there will still be a paperback version released in the future as well for anyone that prefers that format. I don't work in JS at all professionally but this book has intrigued me for a while at this point after seeing it recommended so often. I think I'll pick up a copy once the paperback is released.
- ricardobeat 3y agoIt's a great explanation, but I've never heard the term 'binding' used to describe variables. It's usually reserved to function binding or bridge APIs like the DOM. The tricky thing is that "boxes" are the right abstraction for primitive values. After that you need to explain how references work, and that's pretty much the same 'tentacle' concept. This method spares the reader one step, but might cause confusion once they face problems that require that understanding.
- pier25 3y ago"binding" seems like a more casual term for memory pointer. I guess if people are just getting started with programming it make sense to simplify things a bit.
- alyandon 3y agoSerious question - has Javascript the language evolved any features for handling integer math correctly so expressions like 2*57 aren't silently rounded? I realize that in most cases Javascriopt is "good enough" for useful work but I've seen even senior engineers get tripped up by Javascript's corner cases when it comes to its handling of integer vs float.
- wk_end 3y agoThere's BigInt [0]. Probably less useful for this specific case, but possibly useful as well, are typed integer arrays [1]. [0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Typed_arrays https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...
- alyandon 3y agoAh, very cool. Thanks.
- throwaway632 3y ago> handling integer math correctly JavaScript doesn't have integers. Everything is a float. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... Although it has BigInt now.
- alyandon 3y agoYes, I'm aware that internally it is using floating point representation and that is one of the main reasons I avoid using it for anything math related. However, I am now aware that BigInt() exists so thanks for the link.
- deleted 3y ago[deleted]
- kymm 3y ago[flagged]
- z3t4 3y agoSomeone asked about integer support in JavaScript. JS now supports BigInt! >2**57 144115188075855870 >2n**57n 144115188075855872n
- ethagnawl 3y agoThat's news to me! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- alyandon 3y agoYes, I was asking about that and I'm very happy to see this exists now.
- williamstein 3y agoAnd in some JavaScript engines (eg V8) bigint multiplication is asymptotically fast, unlike say the default CPython. It’s a very pleasant surprise if you happen to be a number theorist (say).
- csjh 3y agoHow do you mean? CPython uses karatsuba's for large numbers which should be asymptotically fast https://github.com/python/cpython/blob/d864b0094f9875c5613cbb0b7f7f3ca8f1c6b606/Objects/longobject.c#L3816 https://github.com/python/cpython/blob/d864b0094f9875c5613cb...
- bovermyer 3y agoOh thank god. I've been having to do some hacky things to represent numbers on an astronomical scale for my star system/planet generators.
- deleted 3y ago[deleted]
- samtho 3y agoThis is, in my opinion, the book to use to learn JavaScript at more than a surface level. The only other materials I recommend as much (but for a different level of learner) are the “You don’t know JavaScript” in-depth book series. In 2015, I was consulting for a distance learning program, administered by a major California University, that wanted to replace their current textbook (one of those “Head First” O’Reilly books) with something that had a bit more meat but was very approachable. I immediately recommended this and it was fawned over by both the advisors and instructors. It was also the cheapest option they had in the running (even excluding the fact it can be read for free) as it was competing against traditional text books. One year later, students were polled on it and it was met with a lot of positivity as well.
- idk1 3y agoIf I put "You don’t know JavaScript" into Amazon I get approx 10 books at £20 each, is there a specific one / author I should look for, of even better and ISBN. Thanks!
- samtho 3y agoThere are 6 books, the author recommends reading them in an order: https://github.com/getify/You-Dont-Know-JS?tab=readme-ov-file#titles https://github.com/getify/You-Dont-Know-JS?tab=readme-ov-fil... If the second edition is not available, you can read the first edition, just be aware some small things may be slightly out of date.
- fourside 3y ago[dead]
- Sn0wCoder 3y agoOne hundred percent agree on both this book and the “You don’t know JavaScript”. Both are free (search Kyle Simpson GitHub). I ended up buying the YDKJ first edition paperbacks but see the second edition of all of them are done or a work in progress. EJs is the one I tell my students to start with as IMO is more of a programming book that just happens to us JS. I can tell the ones that read it (it’s optional) and the ones that do not. I do a few random chapters every year and learn something that I either missed or forgot I knew every time. I am mostly using TS these days but also enjoy vanilla JS for side projects and prototypes. Note the YDKJ books can come off as very ‘only my opinion is the right one’ kind of like JS the good parts but just look past that and absorb the content, what you do with it after that is up to you regardless of the author’s opinion.
- veggieWHITES 3y ago>The field of programming is young and still developing rapidly, and it is varied enough to have room for wildly different approaches. This was an interesting line of thought to digest. He's right, of course. Programming is probably still in it's infancy. Studying and learning about programming however, can make you believe it's some ancient art mastered by the giants of our recent past, the perfection of which is never to be surpassed again.
- tithos 3y agohttps://arc.net/boost/3098D5E3-F164-478B-9586-077889192460 https://arc.net/boost/3098D5E3-F164-478B-9586-077889192460 The 'Eloquent JavaScript 4th edition (2024)' in Dark Mode
- wes-k 3y agoFor those that don't know the author, Marijn Haverbeke is the creator of CodeMirror (code editor) and later ProseMirror (text editor). https://codemirror.net/ https://codemirror.net/ https://prosemirror.net/ https://prosemirror.net/
- jamager 3y agoProsemirror user, it is fantastic. Didn't know Marijn was so prolific, all with free/open source projects. Wonder how can make a living...
- felideon 3y agoI'll always know him as the author of Postmodern, an impressive CL library for PostgreSQL: https://marijnhaverbeke.nl/postmodern/ https://marijnhaverbeke.nl/postmodern/
- jmkni 3y agoChapter 11 on async is particularly good, I still get confused by async/promises sometimes in Javascript - https://eloquentjavascript.net/11_async.html https://eloquentjavascript.net/11_async.html
- felipefar 3y agoPart of the force of this book comes from its explanation of fundamentals of computing, and how it relates to javascript. Another part is due to how interesting are the projects that it proposes that the reader build. I don't even like programming in javascript but was drawn to read the book.
- NlightNFotis 3y agoFancy seeing this here, some days after finishing the third version :) I'm also glad to see the asynchronous programming chapter significantly reworked - it was materially weaker than the rest of the book because of some weird analogies involving crows and their nests that didn't seem to make any sort of sense to me. The third edition also gave me the impression that it was a reasonable book to learn JS and the DOM (and a sprinkle of Node.js, for good measure), but that it was a book aimed primarily at experienced people who were transitioning to JS and the web - not beginners (despite the book's efforts at claiming suitability for beginner programmers).
- m1keil 3y agoAh! I vaguely remember rage quitting over the crows but didn't remember which book was it. I should give this another try then.
- Jerrrry 3y ago>book because of some weird analogies involving crows and their nests that didn't seem to make any sort of sense to me. I am glad I am not the only one. I believe he over-abstracted it to it's own detriment. I went to purchase a paperback earlier this week. Now I will wait for this one to hit print.
- ginkgotree 3y agoThe best JavaScript book out there, IMHO
- synergy20 3y agoGreat book, looking for some info about main changes from 3rd edition but did not find it.
- ibobev 3y agoI'm currently going through a hard copy of the book's third edition. But I'm wondering whether the description of the language in the book is detailed enough. Could you share some opinions on whether it will be good to go through some other JavaScript books after it? I'm considering going through "JavaScript: The Definitive Guide"[1] or "The Modern JavaScript Tutorial"[2] after it. [1] https://www.amazon.com/JavaScript-Definitive-Most-Used-Programming-Language/dp/1491952024/ https://www.amazon.com/JavaScript-Definitive-Most-Used-Progr... [2] https://javascript.info/ https://javascript.info/
- XeO3 3y ago"JavaScript: The Definitive Guide" does go deeper, with thorough examples in all the topics mentioned in the index. It also provides examples of static types using Flow instead of TypeScript.
- ravenstine 3y agoI don't mean to throw shade on the whole book, but I don't think the section on errors takes things in the right direction. A distinction should be made between errors and exceptions. In JavaScript and many languages, we conflate the two and use exception handling as logic flow control. In my experience, this can end up being a headache and encourage unnecessarily weird structuring of code. Look at this example from the page on errors: --- function getAccount() { let accountName = prompt("Enter an account name"); if (!Object.hasOwn(accounts, accountName)) { throw new Error(`No such account: ${accountName}`); } return accountName; } --- The possibility that a user will enter a account name that doesn't exist is not an exception, but we are treating it like one in this case. In order to handle this exception when getAccount is called, we have to wrap it or some higher level scope in a try-block and then regex-match the error message if we want to handle it differently from other errors. You might be saying "it's just an example", but there's plenty of production code in the wild that is written this way. Maybe this could be improved by subclassing Error, but now you're having to manage a bunch of clutter and using object-oriented features as a way to reliably determine what kind of exception you're dealing with. I find this pattern to be preferable: --- const ACCOUNT_NOT_FOUND_ERROR_CODE = 1; function getAccount() { let accountName = prompt("Enter an account name"); if (!Object.hasOwn(accounts, accountName)) { return { accountName: null, error: { code: ACCOUNT_NOT_FOUND_ERROR_CODE, message: `No such account: ${accountName}`, } }; } return { accountName, error: null }; } --- Then we can call the function like this: --- const { accountName, error } = getAccount(); if (error) { if (error.code === ACCOUNT_NOT_FOUND_ERROR_CODE) { errorModalService.show(error.message); } } else { // do something with the account name } --- No doubt, you may still want to catch exceptions at a higher level scope, but at the nice thing here is that exceptions (almost) always represent actual unexpected conditions that aren't being handled properly while return values with error codes represent expected conditions and can be handled like any other logic in your code. It also reduces any ambiguity of how an error should be handled but without subclassing. An error can even contain more information than just a message if you want it to. Also, if you really want to ignore an error for some reason, then you can just pretend that the error doesn't exist. No need to use a try-catch where the catch-block is a no-op. I wish we'd encourage this sort of pattern, but maybe that's one of many pipe dreams of mine.
- justanotheratom 3y agoWhat if one is using TypeScript?
- brink 3y agoThe rules still apply.
- mixmastamyk 3y agoI have Zakas' Professional JavaScript for Web Developers and ECMAS 6 update. Was very happy with them (easy to read) but both are getting long in the tooth and the author seems to have lost interest in updates. How does this one compare as an all-in-one? Being up to date is a win, but I'm wondering about the quality of the writing.
- justanotheratom 3y agoI wonder if such high quality free books are already fed to LLMs during training?
- 0xCMP 3y agoThey're open source and easily accessible, so I would practically guarantee some/most of them are using it and other open source books. Given so many are just on Github and very well known/linked-to I doubt they even put any special effort into getting these specific resources.
- lazysalmon35 3y agoWhen is the print book coming ?
- panphora 3y ago> Paper book will take a while longer. According to the author, Marijn Haverbeke. https://mastodon.social/@marijn/112020092273623390 https://mastodon.social/@marijn/112020092273623390
- deleted 3y ago[deleted]
- illegalsmile 3y agotest
- aydoubleyou 3y agoI don't consider myself a good programmer. I struggled throughout my youth to grasp even the basics. This book pointed me in the right direction. Can't recommend it enough.
- culopatin 3y agoAnd how are you doing today?
- prudentpomelo 3y agoDefinitely one of my favorites. It helped me level up when I was learning Javascript but also helped me understand how to be a better programmer.
- TheRealPomax 3y agoThe one odd thing in it is that it still claims SVG markup needs a namespace. Which it doesn't, SVG became part of the HTML5 spec and emphatically should _not_ use namespaces when used as "just another element" inside an HTML document. (even though you do need a namespace when creating svg elements through createElementNS, both "of course" and "unfortunately", and of course you need namespaces if you're creating an actual stand-alone SVG document)
- _obviously 3y agoSounds like a joke, an oxymoron.
- coding-saints 3y agoGreat book
- slow_typist 3y agoHow does Eloquent JavaScript compare with Horstmann‘s JavaScript for the Impatient?
- no_wizard 3y agoIts not for the impatient, its a deeper dive than that.
- deleted 3y ago[deleted]
- degun 3y agoThis is what really taught me JavaScript.
- jimhefferon 3y agoDoes the author ever talk about why he is publishing a free version along with a more traditional paper version?
- marijn 3y agoMakes it available to more people. Also probably helps paper books sales more than it hurts them, through exposure.
- radicalriddler 3y agoFrustrating that the online version uses weird format for it's code blocks, which leads reader view (Mozilla Readability) to not put code in a <pre> tag or a <code> tag and leaves it as plain text.
- marijn 3y agoHow is a `<pre>` tag for code blocks a 'weird format'?
- looshch 3y agodoes anyone know where can i get the list of changes compared with the previous edition?
- gassiss 3y agoSeconding the sentiment on this thread, I used this book to learn JS 5 years ago, and it's awesome. I've never seen another resource as good. YDKJS is more of an advanced treatment. If you're a beginner it feels academic, while Eloquent JS is very practical and approachable.
- jslakro 3y agoFirst jquery, then React, now this book reaches a new version. Good times for JS
- jgord 3y agoLooks pretty solid. CH 5 : "Higher Order Functions" seems a nice segway into one of my favorite, lesser known js util libraries Ramda.js
- cradle 3y agoWhere is the physical copy of the 4th edition? I can't find it.
- rnewme 3y agoNot yet, soon. It is in the making
- pojzon 3y agoTo learn js I recommend „WAT” tutorial. Nothing changes in last few years. We still go in with what we incorrectly assumed at the start.
- ferdinandeve 3y ago[dead]