Skip to content

Instantly share code, notes, and snippets.

@rnavarro
Created August 16, 2012 23:18
Show Gist options
  • Save rnavarro/3374415 to your computer and use it in GitHub Desktop.
Save rnavarro/3374415 to your computer and use it in GitHub Desktop.
o = {
tfns: ['a','b', 'c'],
templates: {},
templates2: {},
loadTemplates: function () {
var t = this.tfns;
console.log('loading templates');
$.each(this.tfns, function(i,e) {
console.log('each');
console.log(e);
t[e] = 'snake';
});
console.log('each done');
console.log(t);
this.templates = t;
for (var e in this.tfns) {
console.log('for');
console.log(e);
this.templates2[e] = 'snake';
}
console.log('for done');
console.log(this.templates2);
},
get: function() {
console.log('getting templates');
console.log(this.templates);
console.log(this.templates2);
console.log(this.templates2.a)
}
}
o.loadTemplates();
o.get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment