Skip to content

Instantly share code, notes, and snippets.

@amites
Created December 24, 2014 03:04
Show Gist options
  • Save amites/73568b016b43126cd055 to your computer and use it in GitHub Desktop.
Save amites/73568b016b43126cd055 to your computer and use it in GitHub Desktop.
function control_zone() {
this.var_a = 'a';
this.var_b = 'b';
this.var_c = 'c';
this.do_stuff = function() {
// do stuff with variables
console.log('var_a: '+this.var_a);
console.log('var_b: '+this.var_b);
console.log('var_c: '+this.var_c);
console.log('var_d: '+this.var_d);
}
}
var zone1 = new control_zone();
var zone2 = new control_zone();
zone1.var_a = 'zone1 a';
zone1.var_b = 'zone1 b';
zone1.var_c = 'zone1 c';
zone1.var_d = 'zone1 d';
console.log('calling zone1');
zone1.do_stuff();
zone2.var_a = 'zone2 d';
zone2.var_b = 'zone2 e';
zone2.var_c = 'zone2 f';
console.log('calling zone2');
zone2.do_stuff();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment