Hacker News new | past | comments | ask | show | jobs | submit login
Speaking JavaScript (speakingjs.com)
204 points by rauschma on March 20, 2014 | hide | past | favorite | 61 comments



I hate books with contents like: Variables and Assignment Values, Booleans, Numbers, Operators, Strings,Statements, Functios, Exception Handling, Strict Mode, Variable Scoping and losures, Objects and Constructors, Arrays etc... there are milions books like that. I require from book to introduce me into new language in a manner where i don't have to suffer due to going throught dry facts and definitions. Give me pure examples. I want to create something useful during lecture of book about programming.


Give Underhanded JavaScript a try then. It teaches you how to be an arsehole JS developer :P - published today too (http://leanpub.com/underhandedjavascript/c/NackerHews)

The book is laid out by logical topics (on how to purposely write bad/underhanded code, followed by explanation on why/how they work) instead of keywords (such as IIFEs, automatic semicolon insertion, function calls etc)

disclaimer: I wrote it

EDIT: I skimmed through Speaking JavaScript. It's a bloody good book, much better than mine. You probably should read that

One more EDIT:

Since there was another thread which I gave a coupon for HNers, here's the link:

http://leanpub.com/underhandedjavascript/c/NackerHews


This book is too expensive. I would only buy it if I saw a physical copy and judged a few pages funny.


Agreed. Books that focus on teaching syntax and common use cases really fall flat for me. The best programming books teach you how to think in the syntax of the language. Eloquent Javascript [1] does a good job of that and is also free.

The best programming book at teaching a practical contemporary language in depth while teaching you to think with it is Metaprogramming Ruby. That's a great read for anyone considering writing a book to teach a programming language. And the best book I've ever read on thinking about programming comprehensively is SICP. Which again, I would recommend reading at least half of if you are going to write a book teaching a language.

1. http://eloquentjavascript.net/


Even though it is about Scheme, the insights in SICP are invaluable for JavaScript programmers (the way I explain and visualize closures and environments are inspired by it). It’s one of the best programming books I’ve ever read.

Give my book a chance, it is complementary to both SICP and Eloquent JavaScript.


Sorry I don't mean to be overly dismissive. I'm taking a look right now. I do like that you include history & background. Also I like the addition of a style guide and a separate section on tools like modules & package managers.


You might like Javascript Allonge, a lot

https://leanpub.com/javascript-allonge/read


Hey, I stumbled across a post of the author of eloquentjavascript that he's crowdfunding second edition of the book. My question is - how current is the first edition? Is it suitable to teach me JS, considering it's quite old? I'm not a good programmer. I know a bit of python, mainly for statistical tasks and some automation/scraping.


The second edition is partially online already at http://eloquentjavascript.net/2nd_edition/preview/


It's a great intro to Javascript. It's not going to teach you the most current webdev libraries but if you start with a strong foundation in Javascript (which you will get from Eloquent Javascript) you should be fine applying your knowledge to using popular libraries.


Thank you! Thanks to marijn too!


Personally, I love learning from books like this one and consider tutorial-style books a complete waste of my time. It's a matter of learning style, and the differences are fairly well understood. Look up deductive vs inductive teaching.

Teachers try to use both methods, but book authors don't have to. Readers are free to learn from any book that suits them.


If you’d take the time to read the free online copy (which OP links to) you’d see that there are plenty of “pure examples” in the book. In fact, there’s a code example for every two paragraphs of text, or so.


I agree. I enjoy weird quirky books that actually have a narrative and you build projects and learn the syntax while you are doing more interesting stuff.

However, I've read many books with tables of contents that look like that, yet they were actually pleasant to read and much more interesting than their contents implied.


I hate books with contents like that too - I've read about those things many times already and unless the language I'm currently learning really does something interesting in one of those areas reading whole paragraphs of text on them is just a waste of time. I'm recently learning Forth, and I really do appreciate more detailed explanations, because holy cow, that's some really crazy shit going on :) However, for languages and technologies closer to mainstream - or just similar to what I already know - I use these web sites for an intro:

http://rosettacode.org/wiki/Rosetta_Code

http://learnxinyminutes.com/

http://hyperpolyglot.org/

And then go straight to the most advanced books I can find. It saves me a lot of time and it's more fun than following yet another book structured in exactly the same way, with pages and pages of text about minor syntactical differences and rare interesting things buried deep inside the book.


I humbly disagree. Especially in the case of JavaScript it's a good idea to review JavaScript's specific perspective on functions and object but also variable scope. I personally found "JavaScript Enlightment" quite interesting in this respect.


Don’t judge a book by its TOC! I’d love to get your opinion once you have read or at least skimmed, say, chapter 1: http://speakingjs.com/es5/ch01.html


john resig- secrets of javascript ninja

absolutely the best


'Eloquent Javascript' (http://eloquentjavascript.net/) and 'Learning JavaScript Design Patterns' (http://addyosmani.com/resources/essentialjsdesignpatterns/bo...) are the best resources so far.


I second Eloquent Javascript. It's the book I recommend to JS beginners. Secrets of the Javascript Ninja by John Resig & Bear Bibealt is another good one once you get past the terrible title.

I will checkout Learning Javascript Design Patterns on your recommendation. I bookmarked that book a while ago but forgot to return and give it a read.


Yes about Javascript Ninja, you are quite right. No doubt, its one's best companion for getting firm grip on cross-browser compatibility issues.


Recently found this :

http://www.comp.nus.edu.sg/~cs1101s/sicp/

SICP in Javascript.While the coding style is a little bit old school this should be linked in every javascript book / blog about learning Javascript. This stuff is just awesome.

I would gladly pay 30 bucks for a revised paper back version.


Also see Higher-Order Javascript by Sean M. Burke which is a "JavaScriptish companion" to Mark-Jason Dominus's Higher-Order Perl book - http://interglacial.com/hoj/


thanks for the link.


I wonder if it's a good idea to read SICP for the first time in a... let's say a language that people have mixed feelings about rather than the original version of the book. I guess nothing wrong with learning Scheme but as a JavaScripter this looks too good.


Sweet, looks like something fun to work with this weekend, thanks for sharing!


This book deliberately omits talking about Javascript in the browser, but the only reason I want to study Javascript is for its use in a browser context!


It’s a matter of deliberate focus! If you are interested in browser stuff, you can either combine Speaking JS with the content on MDN [1] or buy a different book. I like the books by Nicholas Zakas and “JavaScript: The Definitive Guide”.

[1] https://developer.mozilla.org/en-US/


There's no shortage of books about JavaScript in a browser context. There's fewer books on JavaScript that don't fairly exclusively focus on that context.


I never knew that NaN is not strictly equal to itself in JavaScript (so NaN === NaN => false). Very interesting.


The reason is simple:

"hello" is Not a Number. "world" is Not a Number.

(Number)"hello" == (Number)"world" returns false.

EDIT: Another reason why this is the case is because IEEE mandates it to be. All numbers in JS are 64 bit floating point numbers. This allows for a crazy amount of NaNs (and oh the fun stuff you can do with that). To be sane, NaNs are not the same when comparing them (there is a lot more subtlety in that - comparing quiet and signalling NaNs, and so on and so forth)


It makes sense. Just because both things are not something does not mean they are the same.


I would be surprised if it were. All languages I know says NaN == NaN is false.


It's actually part of some cryptic and ancient standard and is common for nearly all languages nowadays. I never cared about it very much, but here's the post on NaN semantics from someone who apparently designed the standard:

http://stackoverflow.com/questions/1565164/what-is-the-ratio...


> cryptic and ancient standard

Cryptic and ancient?! IEEE 754 is the behavior implemented by the chip in the computer you're using to browser HN with right now.


"In current and common use" is not actually the opposite of "cryptic and ancient".


I get your point, but....

Ancient it is not, and old isn't bad. Lots of deep thinking went into IEEE-754, http://www.cs.berkeley.edu/~wkahan/ieee754status/754story.ht... calculating with computers is hard work.


This reminds me of a hilarious Destroy All Software screencast about oddities in certain programming languages: https://www.destroyallsoftware.com/talks/wat


That's the canonical way to check for NaN, in fact.


No. Use isNaN() instead. Or if you have ES6 support, Number.isNaN() is much better an implementation than window.isNaN()


This makes it easy to test for NaN! It's the only value for which this is true. (And the built-in isNaN() function has misleading behavior.)


if a !== a then a is NaN


Is it possible the author is getting more revenue from that little ad on the right side then from actual sales?

Is it common for O'Reilly authors to release their books this way?


I strongly considered the approach of releasing the contents of my recent book online with Mining the Social Web 2E [1] but instead decided to pursue what I felt was a standard OSS model: release a really high quality version of the source code that's optimized for easy learning in IPython Notebook format (optionally packaged as a turn-key VM) on GitHub [2] with the book being a form of "premium support" for the codebase if people want to learn more or dig deeper. I touch on all of this somewhat in the book's blog's "book as a startup posts" [3], and it seems to be working well so far.

I'm increasingly becoming interested in the prospect of releasing the entire contents of the book (both prose and source code) in IPython Notebook format so that you could read and work in the book seamlessly as "executable paper" like this full-text sampler of Chapter 1 [4] if it were hosted on Wakarii or a similar platform that offers a free tier. It really seems to me that this is the future of tech books: learning platforms with prose and example code integrated seamlessly.

[1] http://amzn.to/GPd59m

[2] https://github.com/ptwobrussell/Mining-the-Social-Web-2nd-Ed...

[3] http://miningthesocialweb.com/category/book-as-a-startup/

[4] http://bit.ly/IW3cbc


It’s an experiment of mine (but I am aware of at least one more O’Reilly book that has been published this way). I’m hoping that it’s win-win: The public version lets people share and link to what they have read (click on a title to create a link to it). And it allows them to figure out whether the book is for them. But I believe that it will also help sell books.


[deleted]


I agree. Kidding aside. I think Eloquent Javascript is better geared towards experienced programmers:

http://eloquentjavascript.net/

Edit: It seems like the post I replied to was deleted, but my following statements still holds true.


Eloquent Javascript, while a very good book, is pretty old and really aimed at beginners.


The second edition is coming along: http://eloquentjavascript.net/2nd_edition/preview/


Really, I think it is totally geared to beginners.


It’s certainly a good book. Can you explain why you think it’s better geared towards experienced programmers?


I previewed the table of contents of Speaking Javascript and it looks cool and comprehensive, but Eloquent Javscript discusses functional programming and only spends a little time on the bare basics.

I'm not saying that either book is better. In my opinion Eloquent is for more advanced folks, while Speaking might be geared towards beginning programmers.


I have to agree with this. I've worked with JavaScript in previous jobs but never took the time to really dig into the language and learn it in and out. I just applied my knowledge of other languages and looked things up when I needed to.

I'm working through Eloquent JavaScript (v1) right now and I'm on the chapter dealing with functional programming. Even with the programming classes I've taken in college, I'm finding this chapter to be much more difficult than any of the ones before it. Maybe it's uncommon, but I was never shown this type of programming ever before. Even though I'm progressing through it at a painstakingly slow pace, it's starting to make sense. But for someone who looked at EJS as their first programming book? I can understand why they may quit altogether.


Have you ever seen Underscore.js? It's a javascript toolkit for solving problems in a functional manner.

If you are interested in learning more, the video below walks through examples.

http://youtu.be/tbt36MvV6qQ


I've briefly looked at it in the past but not in much detail. Thanks for the video. I'll have to check it out.


Note that the basics only seem simple. Speaking JS covers them, but also (as optional reading) exposes many of the mechanisms behind them. For example: [1].

The book explains the complete language. I consider functional programming more of a (fascinating and important!) meta-topic; worthy even of dedicated books [2] and beyond the scope of Speaking JS.

[1] http://speakingjs.com/es5/ch18.html#_array_indices_in_detail

[2] “Functional JavaScript” by Michael Fogus. http://shop.oreilly.com/product/0636920028857.do


What did the original post say?


“I didn't remember the exact wording, but he/she mentioned something in the lines of Javascript is better written than spoken.”

In that case, you’re gonna love this book. There’s a small code example for every two paragraphs or so, which really helps make things clear. (Disclaimer: I was a technical reviewer for this book.)


I didn't remember the exact wording, but he/she mentioned something in the lines of Javascript is better written than spoken.


Anybody else getting 404s?


I saw some tweets yesterday from which I inferred there have been some DNS propagation issues. I notice the IP is an S3 one so I tried.. http://s3.amazonaws.com/speakingjs.com/es5/index.html and it seems to work, so might be a good temporary workaround.


thanks!




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: