JavaScript is definitely the “hot” old language with a new spin. With Microsoft betting on JavaScript with Windows 8 and their WinRT platform architecture now it probably a good time to start learning it.
So where do you begin?
A couple key starters are books. Two highly recommended books are:
JavaScript: The Definitive Guide by David Flanagan – a must have for your bookshelf
JavaScript: The Good Parts by Douglas Crockford – short and to the point. Excellent read.
I would caution that quite a few books out there (5,182 results for “JavaScript” on Amazon) are actually bad. I’ve seen quite a few that don’t have best practices in mind and don’t key in on critical performance issues or security. So be careful when choose other titles. It helps to read the reviews.
So, to begin your journey I would say read (at least) most if not all of the JavaScript: The Definitive Guide. I find reading it all the way through and then revisiting it by actually coding along is helpful for me.
Your way of learning may be different of course.
Pointers:
- JQuery. Remember the first Predator movie? Remember when that guy with the big gun first saw the Predator and then basically mowed down the entire jungle? Don’t mow down the jungle with JQuery unless you need to. JQuery is a great tool and it can solve some hard problems pretty quickly. However I encourage you to crawl before you can walk by actually learning JavaScript itself first. Many problems or tasks you might want to use JQuery for can easily be accomplished with Vanilla JavaScript (VanillaJS) garnering much better performance.
- Learn how to manipulate the DOM with getElementById and other “selectors”. This is half of everything you will do with JavaScript so learn them well.
- Learn how to make it object oriented for performance and readability. You’ll thank yourself later when you have to revisit old code.
- Keep it organized. Don’t be afraid to pull it out of the page and put it in its own file. This is a cleaner way of doing things and makes it easier to revisit (like #3).
- Put your script tags on the bottom of the page. JavaScript will hog the browser download and parsing stream and will block regular content (images, css, html) from rendering until it’s done. By putting the script tags at the bottom of your page you allow the page to render quicker for your users.
If you have other words of advice for newbies please post your comments.
Happy JavaScripting!