But despite these flaws, JavaScript is arguably the most commonly used programming language, at least in certain regards. Java may win in terms of official usage, but JavaScript is omnipresent and commonly the language that someone will first try "hacking around" with. And modern browsers have changed the rules - optimizing JavaScript is important and as a result it's actually possible to do some real things with it.
Adding client-side power and expressiveness to a webapp is very valuable, and so knowing at least enough JavaScript not to hurt anything is helpful. The trouble is that nondestructive coding is particularly hard with a language where variables are dynamically typed and by default global (e.g. unless you use var) and "==" comparisons coerce type (you want "===" for a true equivalency). It's incredibly easy to write JavaScript code - it's incredibly hard to write good JavaScript code.
A good place to start is JavaScript in Ten Minutes, which is in some ways almost a hyper-abbreviated version of JavaScript: The Good Parts
JavaScript in Ten Minutes gives a very quick overview of types and syntax and then proceeds to give some nice attention to objects and prototypes. This includes some features that actually distinguish JavaScript in a nice way (the inspiration behind "The Good Parts" book title), where you can use prototyping to easily maintain a common property across many objects.
I won't go into much more detail as the whole point is the source itself is a quick read. If you have any interest in JavaScript I'd say it's worth your 10 minutes. And if you find yourself wanting more, I'd recommend either of the O'Reilly books I linked to above.
No comments:
Post a Comment