1. The JavaScript Language

Last modified: August 30, 2009 - 10:27

The JavaScript language is easy to understand for those already familiar with PHP. There are some important and obvious differences between the two, e.g. the operator used for concatenation: php uses the dot (.), while JavaScript uses the plus sign (+); also Javascript does not use "$" to identify variables. Other than that, JavaScript and PHP are both dynamically typed languages (i.e. without strong typing like in C++), and share many language structures, such as the "if (...) {...}" and "for-loop" construct.

JavaScript can be used as an object oriented language, though its idea of objects is different in many respects from the object orientation of, say, C++ or Java. To become really adept at JavaScript you would need to be very familiar with concepts such as variable scope, context (using the 'this' keyword), closures, prototypal inheritance, and methods.
A great resource for getting a taste of these concepts is the website of leading JavaScript architect, Douglas Crockford. There are also some very helpful references, such as the Mozilla Developer Center for comprehensive language documentation and the handy W3Schools code reference.

If you are unfamiliar with Object Oriented Programming, you might like to do some background reading to get at least a general idea of what it's all about:

Even without studying the JavaScript language in great detail, it is possible to use it to create simple but effective functionality into your web pages. But an understanding of how JavaScript interacts with the DOM is absolutely essential.

 
 

Drupal is a registered trademark of Dries Buytaert.