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-bungie-book-has-landed
>
> 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