
How to Learn JavaScript Properly - Vuiisiq
http://javascriptissexy.com/how-to-learn-javascript-properly/
======
sivers
I've basically just finished this process, described in the post, over the
last few months.

Experienced with PHP, Ruby, and SQL, but zero JavaScript.

(1) - Tried to read Crockford's "The Good Parts", but was completely confused.

(2) - Read "Professional JavaScript for Web Developers, 3rd Edition", cover-
to-cover, making sure I used and understood each point before continuing.

[http://www.wrox.com/WileyCDA/WroxTitle/Professional-
JavaScri...](http://www.wrox.com/WileyCDA/WroxTitle/Professional-JavaScript-
for-Web-Developers-3rd-Edition.productCd-1118222199.html)

(3) - Went back to "JavaScript - The Good Parts" and realized that
"Professional JavaScript for Web Developers, 3rd Edition" had already covered
everything in it, but explained so much more clearly.

(4) - Now I'm trying intermediate to advanced JavaScript books ("Secrets of
the JavaScript Ninja", for example), and finding that "Professional JavaScript
for Web Developers, 3rd Edition" covered most of their lessons, too.

The point?

If you want to learn JavaScript, (or recommend one book to someone else who
wants to), whether you're an experienced programmer or not, get "Professional
JavaScript for Web Developers, 3rd Edition". It's thorough and great.

Direct link to the publisher where you can get the DRM-free PDF:

[http://www.wrox.com/WileyCDA/WroxTitle/Professional-
JavaScri...](http://www.wrox.com/WileyCDA/WroxTitle/Professional-JavaScript-
for-Web-Developers-3rd-Edition.productCd-1118222199.html)

~~~
gem
If you buy the book from the above links, the coupon code WTR12 should give
you 20% off.

------
gnosis
_"But while Mr. Crockford, who is immensely knowledgeable in JavaScript, is
seen as the Einstein of the JavaScript world, his book, The Good Parts, is not
a good JavaScript book for beginners."_

Why not?

Also, does he mean it's not good for people who are just starting to learn
programming? Or also for experienced programmers who are starting to learn
Javascript?

What would be a good book to start with for experienced programmers just
starting to learn Javascript?

~~~
why-el
Recommending _Javascript the Good Parts_ to Javascript beginners is like
recommending _Effective Java_ to Java beginners. It is assumed you know some
js/java and preferably have written some of it so that the patterns and
antipatterns described in both books (Crockford's to a lesser degree, it's
after all about the good parts) would make sense.

~~~
doktrin
> _Recommending Javascript the Good Parts to Javascript beginners is like
> recommending Effective Java to Java beginners._

Or, like recommending K&R C to beginners (C beginners, but even worse to
_programming_ beginners). There are a handful of books out there that, IMHO,
are _vastly_ mis-recommended, and I would agree that JS:The Good Parts is one
of them.

~~~
jamesbritt
Weird. I learned C from K&R and found it helpful and easy to follow. I don't
think I had much coding experience either beyond c64 basic.

~~~
bjoe_lewis
I learned from K&R too, and seriously, no book ever told me how closely arrays
and pointers were related (atleast, whatever books I read), as TCPL. I don't
find anything wrong with recommending it to 'programmers' who begin C.

~~~
cjg_
K&R is great! For a really deep understanding how pointer and arrays are
related I also recommend Expert C Programming by Peter van der Linden
([http://www.amazon.com/Expert-Programming-Peter-van-
Linden/dp...](http://www.amazon.com/Expert-Programming-Peter-van-
Linden/dp/0131774298))

------
evanmoran
This is really nice. I've taught JS to several people and the best advice is
to try to avoid reading snippets from the web if possible. This is a good
approach and I'd also recommend:

<http://eloquentjavascript.net/chapter1.html>

~~~
mkhattab
This book has interactive code examples and is endorsed by Brendan Eich which
is cool, I guess.

[http://www.amazon.com/review/R31YJRU8MO6FD4/ref=cm_cr_dp_tit...](http://www.amazon.com/review/R31YJRU8MO6FD4/ref=cm_cr_dp_title?ie=UTF8&ASIN=1593272820&nodeID=283155&store=books)

------
chewxy
Javascript must be one of those few languages where you cannot learn from bits
and pieces. I learned python, C, shell etc from bits and pieces, but I
actually learned javascript the way OP describes.

This is actually quite puzzling and I've been thinking for a bit. Why is it
one is unable to learn from the instant utility of javascript the same way one
learns instant utility in python, ruby or even C?

~~~
ikura
With an overall appreciation for languages in general, JS isn't too difficult
to pick up small pieces... I'm completely new to JS, but can get by with
modifying examples for use in Parse.com's cloud code for instance. I've also
heard from non-programmers getting good results with jQuery. I'm now looking
to delve deeper into JS through Node.js, but each to their own.

~~~
chewxy
JS is actually very easy to pick up in small bits. But somehow picking up the
knowledge in small bits tend to lead to quite crappy programs. At least in my
experience

~~~
ikura
That's certainly very true. Like any technology, there's learning how to use
it, and learning how everyone else uses it. JS is almost too flexible,
allowing programmers to get themselves very stuck - so learning how everyone
else uses JS is an essential goal in its own right.

~~~
shantanubala
I think one of the biggest issues with JS is its lack of an intuitively
obvious inheritance scheme. Until you get a full grasp of prototypes, you're
not going to really know what the all the objects _are_. Couple this with a
lack of namespacing and you can have a lot of trouble structuring large
programs effectively.

------
kevin_rubyhouse
I've tried to teach my friends and acquaintances that are interested in
programming, but my curriculums never work out. It seems that the bigger
problem for the guys I'm talking about (high school and college age) is self-
motivation and drive that they are unfamiliar with from their academic
careers. Anybody motivated enough could learn programming because all of the
necessary resources and training is freely available. The OP's curriculum
looks like a fantastic way to get into JavaScript for somebody motivated. The
bigger question then is, how do you motivate somebody that likes the idea of
programming to also happily accept the hard work involved?

~~~
thirdsun
I guess the key to staying motivated is the need to apply these (potential)
skills to actual real world problems - no matter how small they may seem.

That said, I'm trying to get into Rails and Ruby and I'm in a similar boat as
the friends you described. At work I'm a FileMaker developer, which might
sound like amateur hour to the HN community. I'm very well aware of FileMakers
shortcomings, but it also works quite well for our little non-tech company,
which is why there is no immediate need to learn more advanced languages. Add
to that outside my day job, I'm a musician/producer - this is a hobby as well
as an occational source of income, but it takes time and there's only so much
left when I get back home, which caused my drive to keep learning to behave
more like an on/off relationship.

Nevertheless I try to hang on to it. Having experience with developer tools as
well as audio production software and hardware, I have to agree with you -
people interested in programing have everything they need readily available.
Sure, it got a lot easier for musicians too, but usually a decent DAW, plugins
or audio interfaces and monitors still require a financial investment, which
certainly helps to remind you about your original goals. Meanwhile frameworks,
editors and documentation are mostly free - combined with limited time and a
lack of concrete need for your new knowledge, it can be tough.

~~~
kevin_rubyhouse
Well, what is motivating you to get into Ruby on Rails in the first place? If
it's money or a better job, is there anything else driving it?

~~~
thirdsun
I like the company I'm working at and I'd like to contribute by taking our in-
house solutions based on FileMaker to a web application. Furthermore I want
those skills as a backup - in case I want (or have) to look for another job,
FileMaker isn't going to impress. Also, while the music is certainly my
passion, it's unlikely that I (or most other musicians for that matter) could
make a living with it.

However those reasons sound rather career- and money-centric. It's not all
that rational though - I like making and creating things, whether it's music,
software or design - but I value doing things right and with care. Learning a
"proper" language/framework and being competent with it would help a lot and
I'd consider it as essential.

------
zachgalant
If you're trying to learn JavaScript, you should check out <http://codehs.com>

We're making it really easy and fun for beginners, and we provide help and
feedback on all of your code from expert tutors.

Check out some of our demos at <http://codehs.com/demos> (most of them work on
your phone as well) to see what you'll learn to make.

------
RobinL
I'm currently in the process of learning Javascript. I've use Codecademy to
get started in the basics. In terms of books, I've used The Good Parts,
Javascript: The Definitive Guide, and Secrets of a Javascript Ninja.

The thing I've struggled with is finding examples of 'good practice'
programming which are suitable for beginner to intermediate programmers, which
are more than just code snippets.

I'm thinking of small projects, with a code base that it's practical to read
in full and understand. I've struggled with using object orientation
'correctly' in javascript. It would also be good to see a full example of how
namespacing should be done properly in, say, a small website/webapp.

Any suggestion would be very much appreciated.

~~~
just2n
Try reading through the Backbone.js source, it's quite approachable.

------
jamesmcn
I like to use the MDN re-introduction to JavaScript as a starting point:

[https://developer.mozilla.org/en-US/docs/JavaScript/A_re-
int...](https://developer.mozilla.org/en-US/docs/JavaScript/A_re-
introduction_to_JavaScript)

------
fmsf
Gonna put this to a test: "Prerequisite: Completed at least middle school". My
brother lacks 2 years to finish middle school, and I've been wanting to guess
when it is a good time to start teaching him

------
zekenie
I think different folks have different learning styles. For me books don't
really help. I learn programming by programming. Often a well written blog
post that I find on HN, or a tutorial that I find from google teaches me
something I didn't know before. After a while you get a sense of the quality
of a source... After learning like this for a few years, I started to learn a
lot by reading the annotated source of libraries I use (underscore, jQuery...
etc). I just wanted to throw in that I don't think books are for everyone.

------
frozenport
_Do not try to learn JavaScript the first time from bits of unrelated or
related JavaScript tutorials online—this is the worst way to learn a
programming language._

Is this really true, from my experience the people who were self educated had
a remarkable perseverance to get the job done and were particularly good at
mastering the non-programming parts of the work such as client relations,
math, science. I think its the best way to learn, because it also teaches you
how to learn.

------
g2e
It seems like everybody starts out, just like I did, with "The Good Parts"
only to realize that the book is much too abstract for practical purposes.
With that said, there IS a reason as to why the book is so highly rated. It
might not help you directly write your first JS application but it prepare the
reader produce what the world really needs - good code.

------
elbear
Can anyone say what is a good JavaScript learning resource for people with
programming experience? I'm interested in tips on writing idiomatic code and
the pitfalls that should be avoided.

~~~
jimhefferon
Probably the same path. I am experienced, and I found Crockford's book not
right for me for a learning resource.

~~~
just2n
It's pretty similar. I'd avoid Crockford's dogma for a while until it's clear
to you naturally why you should follow those rules (and only loosely, he's
pretty adamant about things that aren't useful or are counter productive in
practice: <http://tech.groups.yahoo.com/group/jslint_com/message/3024>).

Reading Flanagan's book is a good starting point. From there, as an
experienced programmer, you might want more insight into the language and not
just "how to do A, B, and C"s, so I'd recommend after working in JS for a bit
to skim through the ES5 spec and read up on the future of JS to somewhat
future-proof your knowledge (ES6/Harmony, and you can already use some of
those features in Firefox/Chrome/Node.js to get used to them). You might want
to bookmark the annotated version of the spec, as it's a nice reference to
make JS feel less like a strange Twilight Zone (<http://es5.github.com/>).

Experience should tell you that what's important isn't usually the language,
as you pick that up fairly quickly, but in the libraries and APIs that exist
in various environments. Every web developer should learn the DOM for instance
(among many other APIs, notably those introduced with HTML5) and should be
somewhat familiar with the popular JS libraries, at least feature-wise. I'd
recommend anyone new to JS read through Backbone.js's code as it's a great
example of how to write quality, readable code in JS. Outside of reading and
contributing to libraries, there are quite a few to learn, so experiment/play
with them, watch webcasts and read blog posts about them to get a feel for
what people are using them for.

That extends to more than just the browser environment, there's also Node.js,
Rhino, and surely a few others. If you're a Java developer, Rhino might be a
nice way to use existing knowledge of the Java API and do things server-side,
and Node.js is a bit different to get started with but is rapidly catching up
to other languages in availability and quality of libraries (both pure JS and
bindings in other languages).

------
Kiro
So basically read "Professional JavaScript for Web Developers" and
"JavaScript: The Definitive Guide" or is it instrumental to follow those exact
steps in that order?

------
bliker
the problem is... I don't know what I don't know.

------
jwmoz
tl;dr

