Say I have an object such as this:
var time = { \'second\': 1000, \'minute\': 1000 * 60, \'hour\' : 1000 * 60 * 60, \'day\' : 1000 * 60 *
Change the object to a constructor function and you can do this:
function Time() { this.second = 1000; this.minute = this.second * 60; this.hour = this.minute * 60; this.day = this.hour * 24; this.week = this.day * 7; } // Use var time = new Time();