Reputation: 33
I have inherited a block of code and I need confirmation that I'm understanding it correctly. I'm (perhaps obviously) not a javascript expert but I'm trying. I just need some help understanding exactly what the block of code below is doing:
SG_VERSION = "2.1", fss = [], allAni = {}, SG_PATH = "", sgZoom = 1, SG = function() {
function complete() { ... }
function Game() { ... }
function win() { ... }
function resize() { ... }
My understanding is that SG_VERSION is an 'object' with some member variables and a big method called SG, that itself has member functions? But doesn't SG_VERSION need a 'var' somewhere?
Thanks for any insights. I appreciate any and all help however simple it may seem.
Upvotes: -1
Views: 53
Reputation: 8080
Based on your snippet, these seem to be global variables (assuming you didn't miss out an initial var
and that they are not declared inside an outer function() {}),
SG_VERSION = "2.1" // probably a string version representation
fss = [] // empty array initialization
allAni = {} // empty object initialization
SG_PATH = "" // probably to hold string values representing a PATH
sgZoom = 1 // numeric zoom level?
SG = function() {} // a function that seems to be intended for use as a class containing "private" functions complete(), Game(), win() and resize().
For the last variable SG =
I think you've missed out a closing brace in your copy/paste
Upvotes: 2
Reputation: 507
It will be more readable if written like this:
var SG_VERSION = "2.1";
var fss = [];
var allAni = {};
var SG_PATH = "";
var sgZoom = 1;
var SG = function() {...};
function complete() { ... }
function Game() { ... }
function win() { ... }
function resize() { ... }
Upvotes: -1