Lately I’ve been reading up on Javascript functions and objects to get a better grip on frameworks like Prototype and Scriptaculous. Back in May, I saw Glenn Vanderburg’s presentation on Javascript at No Fluff Just Stuff in Reston and had a serious “aha!” moment. For the first time I glimpsed the real possibilities and power of Javascript. Basically, it comes down to understanding functions, objects, and the dynamic nature of the prototype object.

In short:

//you declare a new "class" with a function constructor
function SomeClass(someArgument){
    this.someArgument = someArgument;

//you define a method of the class with the prototype object
SomeClass.prototype.someMethod = function(anArgument) {
    return anArgument; //well, actually do something interesting here ;-)

Prototype has some serious mojo going on and I have to admit I still have a little studying to do to understand what’s going on. But it’s very cool and becoming the core of such wonderful libraries as Scriptaculous.


1 Response to “Javascript”

  1. 1 Steve Stedman July 10, 2005 at 6:50 pm

    The combo of Scriptaculous and the Prototype framework looks like a great way to ease into the AJAX pool. Thanks for the links.

    FYI: Tech Republic posted a PDF recently that might be useful in your OO Javascript quest: <a href="" rel="nofollow">Access the true power of JavaScript with object oriented programming</a>.

Comments are currently closed.



Copyright ©2008-2013 James E Orchard-Hays, All Rights Reserved

%d bloggers like this: