function test() {
this.alerting = function () {
alert("test");
};
this.something = function () {
setInterval(function () {
this.alerting();
}, 1000);
};
}
var a = new test();
a.something();
Calling the function something()
should call the function alerting()
every second. This should alert 'test'
every second. Why doesn't that happen and how can I make it happen? Note that I want to keep this design of calling a method in a method, if possible.