I wanted it to do this way but "this.duration" returns undefined when using it with test: setInterval(function(){console.log("hi hi");}, this.duration);
so confused
Quote:
Originally Posted by Old Pedant
Ummmm... Object.test is the entire sub-object named test within Object.
To call the function test, you would need to do Object.test.test( )
Why do you have the extra layer of another object in there? Why not just
Code:
var Object = {
time: new Date().getTime,
duration: 2000,
test: setInterval(function(){console.log("hi hi");}, this.duration)
}
Object.test();
????
|