Hi,

> Thanks a lot Tobie! :) Ill check those out. Learning JS in detail is
> definitely a must do for me, AFTER this project :D.

FWIW, I suspect you'll save time even on this project if you take an
hour to read through the Prototype API[1] from beginning to end,
especially now that you've got your feet wet.  You may not have time
right now to read through Flanagan's or Crockford's books, but an hour
spent with the API will almost certainly pay for itself right away.

[1] http://prototypejs.org/api

Separately, can I also suggest you read up on two fundamental concepts
that may well trip you up otherwise:  Binding and the "this" keyword
[2], and closures[3].  I've linked some resources about that
(disclaimer: niftysnippets is my blog, not that I post to it much).

[2] 
http://proto-scripty.wikidot.com/prototype:tip-using-an-instance-method-as-a-callback-or-event-handler
(also the articles linked at the bottom of [2])
[3] http://blog.niftysnippets.org/2008/02/closures-are-not-complicated.html

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On May 17, 10:04 am, Vinay Seshadri <yourstruly.vi...@gmail.com>
wrote:
> Thanks a lot Tobie! :) Ill check those out. Learning JS in detail is
> definitely a must do for me, AFTER this project :D.
>
> On Sun, May 17, 2009 at 12:02 PM, Tobie Langel <tobie.lan...@gmail.com>wrote:
>
>
>
>
>
> > JavaScript has got this weird flaw, that if you forget to declare a
> > variable using the "var" keyword, the variable is declared in the
> > global scope instead of the current scope.
>
> > For example:
>
> > function foo() {
> >  bar = 1;
> >  var baz = 2;
> > }
>
> > foo();
> > console.log(bar);
> > // -> 1
> > console.log(baz);
> > // -> ReferenceError: baz is not defined
>
> > As a rule of thumb: Never declare a variable WITHOUT using the "var"
> > keyword. If you want to declare a global variable from inside a
> > function (which should be a sign you're doing something wrong), set it
> > as a property of the window object like so:
>
> > function foo() {
> >  window.bar = 1;
> > }
>
> > foo();
> > console.log(bar);
> > // -> 1
>
> > You should really get yourself a couple of books on JavaScript. I'd
> > strongly suggest getting:
>
> > - JavaScript: The Definitive Guide, Fifth Edition by David Flanagan,
> > and
> > - JavaScript: The Good Parts by Douglas Crockford
>
> > There's also a number of good books on Prototype out there:
>
> > -http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous,
> > and
> > -
> >http://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bun...
>
> > Have fun!
>
> > Tobie
>
> --
> In Sport We Trust !!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to