Вызываю метод sayMeow() в методе voice() без таймаута. Все норм
function catTemplate(cat) {
this.word = 'meow',
this.sayMeow = function(){
console.log(this.word);
}
this.voice = function(){
this.sayMeow();
};
}
var Barsik = new catTemplate;
Barsik.voice();
С таймаутом not a function
function catTemplate(cat) {
this.word = 'meow',
this.sayMeow = function(){
console.log(this.word);
}
this.voice = function(){
setTimeout(this.sayMeow , 1000)
};
}
var Barsik = new catTemplate;
Barsik.voice();
setTimeoutthisуже другой. – u_mulder Sep 11 '19 at 10:00