View Single Post
Old 11-11-2012, 04:02 AM   PM User | #3
bunzu
New Coder

 
Join Date: Jul 2012
Posts: 10
Thanks: 3
Thanked 0 Times in 0 Posts
bunzu is an unknown quantity at this point
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 View Post
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();
????
bunzu is offline   Reply With Quote