I want to call iteration from itself, what would be the best way to do it?
function Items(names) {
this.name = "Bo";
this.iteration();
}
Items.prototype.iteration = function(){
console.log("calling iteration");
setTimeout(function(){
this.iteration(); // <----------- Wrong
this.prototype.iteration(); // <----------- Wrong
// right way <-------------- undefined
} ,1000 );
}
Thought these would work just like this.name
would.