|
Accessing local objects?
Hey Guys,
I'm running into a bit of problem accessing my objects. I'm trying not to duplicate code base or update multiple instances of the same number. This is what I'm trying to do:
Working:
Object = {
test: {
time: new Date().getTime,
duration: 2000,
test: setInterval(function(){
console.log("hi hi");
}, 2000) }
}
Object.test();
Not working:
Object = {
test: {
time: new Date().getTime,
duration: 2000,
test: setInterval(function(){
console.log("hi hi");
}, this.duration) }
}
Object.test();
Notice I changed the 2000 to this.duration hoping I can just set the duration once.
Any help would be great.
Thanks!
|