closed as not constructive by yannis Feb 17 '12 at 18:31
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.
Your answer is experience. I'm afraid there is no other way to become good at it without practise. Try and create similar libraries to the ones you've looked at as an exercise. Keep reading but practise, practise, practise!
"I never could write that code"
Really? Try it first.
You have to program ... a lot.
Study the source code of projects like jQuery, Node.js. Add CoffeScript or ClojureScript to your arsenal.
Check what Google Closure brings to the table.
And of course, bookmark Mozilla Developer Network.
If you chose this field, be prepared to be paid less and be considered less professional/good than c/c++/c#/java/etc.
This is usually the case, especially in terms of salaries. It's very easy to find really good js + html + css coders, but it's kind of hard to find really good c/c++/c# programmers. This is the problem the company I work for (around 300 employees) is facing now. Even students having a good grasp of the mentioned languages were paid better than seasoned JS developers.
Most JS devs learn from tutorials from the internet, and participate in open-source projects, which is quite a good thing - maybe find some FOSS project which uses JS heavily (front-end development for gnome 3, to give you an example) and contribute to it. This way you can gain some experience with the tools and languages.
Besides, find some good rated books on Amazon and read them. But remember, CODING is the way you learn, so start developing, besides reading ;)
But the most important rule of them all is:
Code and try to better yourself every day!
And don't just become a framework junkie who needs the latest plugin or framework to do anything good. Try to master the core language and do plugins or widgets from the ground up yourself. If you can't do that, then you ain't not great yet.
Practice in the field and JQuery. This is the best advice I can give.