Script for Epitrochoid, Slider flicker

 From:  Michael Gibson
6158.8 In reply to 6158.7 
Hi Brian,

> So the g_ label is just a reminder that the object is "global" ? (No var...)

Yup, it's just naming convention to keep in mind which particular variables are global, things can get confusing if you get local versus global variables crossed with one another.

Global variables in JavaScript can still have a var in front of them (and it's generally a good practice to always have the "var" for setting up variables), but if they are declared outside of any function then they will be global.


> Putting var... makes an object non-global?

Yeah if you put a variable with a var declaration and it's inside of a function that variable is then local to that function.

The way variables behave depending on where they are declared is called "scoping", here's a pretty good overview:
http://msdn.microsoft.com/en-us/library/ie/bzt2dkta%28v=vs.94%29.aspx

Variables can also be created in JavaScript without using the "var" in front of them, but those will end up as global variables and it tends to be best to always use the "var" method so that you're keeping track of things more explicitly.

- Michael