XML Feeds

.

[javascript-dev] Re: Global variables in .js

Gary Lee Nelson gary.nelson at oberlin.edu
Thu Feb 21 14:13:31 MST 2008


Yes, that seems to be correct although somewhere I think the documentation
says that variable can be know by ALL .js objects in the patch and not just
instances of a particular file.  Is this true?

Can you declare a global variable without giving it an initial value or
initialize only when the first instance is loaded?

Cheers
Gary Lee Nelson
Oberlin College
www.timara.oberlin.edu/GaryLeeNelson


On 2/21/08 3:51 PM, "John Pitcairn" <cycling74forum at opuslocus.net> wrote:

> 
> Also, from memory, if you declare a top-level variable without "var" in a .js
> file, it becomes global to all js objects loading that file, ie:
> 
> gvar = "check1"; // global to all instances
> var avar = "check2" // local to this instance
> _______________________________________________
> javascript-dev mailing list
> javascript-dev at cycling74.com
> http://www.cycling74.com/mailman/listinfo/javascript-dev





More information about the javascript-dev mailing list