Subject:
Here is an example of JavaScript code:
var User = function(data){
this.name = data.name;
this.delay = data.delay;
this.say();
}
User.prototype.say = function(){
_self = this;
setInterval(function(){
console.log(_self.name);
}, this.delay * 1000);
}
var u1 = new User({name: "user1", delay: 10});
var u2 = new User({name: "user2", delay: 15});
The objects u1 and u2 return user2.
How can we make it so that user1 returns after 10 seconds and user2 returns after 15 seconds?