Essential JavaScript design patterns
addyosmani.com
addyosmani.com
only to discover that he completely hijacked the header link to not work with Ctrl or Middle Mouse clicks.
If the author is reading this: the content of your articles (and this e-book) are typically great. I enjoy reading them and encourage others to look into them as well. But failing at the basics on your own website makes me die a little inside.
I've found programming books difficult to read on my small Kindle. This book is just screaming for an interactive iPad format. I think he'd have to implement a Javascript console in the page, rather than relying on Safari's, but this would be more useful than a mobile format, to me.
I'm going to give the Send to Kindle chrome extension a go for this ebook. He mentions ePub and PDF are coming soon, but I don't think the kindle supports ePub and PDF is less than ideal on it.
01 var mySingleton = function(){
02
03 /* here are my private variables and methods /
04 var privateVariable = 'something private';
05 function showPrivate(){
06 console.log(privateVariable);
07 }
08
09 / public variables and methods (which can access private variables and methods ) */
10 return {
11 publicMethod:function(){
12 showPrivate();
13 },
14 publicVar:'the public can see this!'
15 }
16 }
17
18 var single = mySingleton();
Also, the code is missing semicolons. Missing semicolons is a problem when minifying the code. I would recommend running your example code through JS lint for the next edition of the book.
Still, I've been looking to improve my JS foo and reading through this book may help. I will continue. It is attractively formatted and addresses topics that I want to know more about.
I think overall, this compliments both the jQuery Fundamentals book and Eloquent Javascript quite nicely.