I've written a function in JavaScript that returns, each time you invoke it, a new instance of this Object. Among its properties, this instance has a date property, which is being initialized when 'starting' this object (it's a server object):
instance.startedTime = new Date();
Later on, I have a function that returns this server instance' properties. When calling it, it returns 'undefined' for the instance.startedTime property.
Why is that, and how can I pass the date properly?
为什么不只节省时间呢?
instance.startedTime = (new Date).getTime();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.