Patricio del Sol's COGSCI 121

Human Computer Interaction Programming

Friday, April 21, 2006

W3: Readings

A (Re)-Introduction to JavaScript

Interesting to know that JavaScript can be found not only on a web-browsers web-page but also on Adobe PDF and Adobe Photoshop documents.
I liked the guide very much because it explained everything clearly and simple: straight to the point.
I found JavaScript a simple programming language, and as another programming language, I picked it up easily.
This guide is perfect to have printed close as a reference manual when coding some JavaScripts.

Some parts that I didn't understand quite well are:

The && and || operators use short-circuit logic, which means they will execute their second operand dependant on the first. This is useful for checking for null objects before accessing their attributes:

var name = o && o.getName();

Or for setting default values:

var name = otherName || "default";

JavaScript has a tertiary operator for one-line conditional statements:

var allowed = (age > 18) ? "yes" : "no";

Some other stuff that wasn't trivial are: "functions are objects too" (apply), the "property called arguments.callee" and memory leaks

I am impressed on how powerfull the language turned out to be after finishing reading the guide. JavaScript is way more than a simple scripting language.

A (Re)-Introduction to JavaScript (Flickr)

Nice presentation, same content as the guide above.

0 Comments:

Post a Comment

<< Home