The first group won't be able to afford the book right now, but if you can still manage to give them the knowledge, they won't forget about it, and might come back to buy the book when they can afford it. I certainly did this for many books that been available for free, but as soon as I could, wanted to support the author. Same goes for Open Source software with donation jars.
The second group just want to be able to review something before they buy it, and the purchase is still not just about getting the content, but supporting the person creating the content.
So by having it available for free online, you can easier reach both these groups, as otherwise you mainly get the second one (and pirate copies with varying degree of quality all over the place)
But no open source software is being sustainably developed on contributions form donation jars. There might be 1-2 exceptions, but most open source projects make pennies from donations.
Development of the Linux kernel is largely funded by companies paying for developers to work on it (and by paying membership fees to the Linux Foundation to cover professional LF salaries like Linus').
Not sure there are people who survive on only writing technical books, usually they have another job and do the book on the side of other things. At least as far as I can gather.
The difference with open source projects is that there are a lot of project leaders who in my experience get sucked into an ongoing full-time role for which they receive very little money. Such a role can lead to a good job of course. But my sense is that there are more people doing a full-timeish largely unpaid gig writing software/managing a project than in the case of technical books--which people are more likely to do as a one-off project that they may even do partly on work time.
Back when physical book stores existed, this is how I would buy books. I would go in and skim books and I would buy the ones I was interested in. It is nearly impossible to do this now as the remaining physical book stores can't carry all the books I'd like to skim and potentially buy.
Cory Doctorow in 2008:
> For me — for pretty much every writer — the big problem isn’t piracy, it’s obscurity (thanks to Tim O’Reilly for this great aphorism). Of all the people who failed to buy this book today, the majority did so because they never heard of it, not because someone gave them a free copy.
* https://craphound.com/littlebrother/about/
Now that he's more established and has a fan base it may be less applicable (just like Stephen King may not want to give away his stuff), but if anyone is starting out, getting readers is a challenge in the first place.
FWIW:
I skimmed to see, but did not find, if you specify the target JavaScript version and coding style.
I can't keep up with the rapid change in JS Universe. And I have absolutely no opinions. I just want someone to declare their preferred idiom and stick to it. House rules for objectness, for error handling, for concurrency, for modules, and so forth.
So a project would declare "ES2015, Eloquent JavaScript 3rd Edition, eslint w/ Twitter rules 2018-09-01".
Thanks for listening.