Javascirpt Shortcuts Tutorial
As you know, I’m all about the tutorials. Here’s one via Ajaxian that seems useful if you’re new to the js language:
I have to say that at one point, I truly thought that JavaScript was using some type of “black magicâ€. Things such as closures really threw me for a loop and I was fortunate to have some good folks to walk me through some of the tougher concepts. Not everyone is as lucky and thankfully, we have developers like Christian Heilmann who continue to put out great postings that cover a broad range of topics and experience levels.
In his latest posting, Christian outlines certain JavaScript shortcut notations which make understanding specific JS techniques a whole lot easier. For example, when dealing with objects, there’s the involved way of defining objects:
var links = new Object();
links[’Cute Overload’] = ‘http://cuteoverload.com’;
links[’I can has cheeseburger’] = ‘http://icanhascheezburger.com’;
links[’Pencils at dawn’] = ‘http://pencilsatdawn.wordpress.com’;
links[’Hobotopia’] = ‘http://apelad.blogspot.com’;
and then there’s the easier way using object literals:
var links = {
‘Cute Overload’ : ‘http://cuteoverload.com’,
‘I can has cheeseburger’ : ‘http://icanhascheezburger.com’,
‘Pencils at dawn’ : ‘http://pencilsatdawn.wordpress.com’,
‘Hobotopia’ : ‘http://apelad.blogspot.com’ // < -- again, no comma!
}
Christian provides plenty of great examples that should substantially help new JavaScript developers.
Follow @clientcide on twitter to get notified of new posts.
To follow me personally on twitter, follow @anutron.
December 5th, 2007 at 7:09 am
Thanks for getting this out Aaron! :D
December 6th, 2007 at 1:35 pm
Thanks, I check it out! Greeings from Germany.
May 27th, 2008 at 11:05 pm
Thanks for this helpfull tuterial!
March 5th, 2009 at 11:25 am
I implemented it in our Project http://www.scooble.de it works fine. Do you have some more hints? Please drop me an email. Thx Aaron!