ultimatebuster 14 Posting Whiz in Training

I have an object:

function cat(){
    this.timesSaid = 0
    this.sayMeow = function(){
        setTimeout(this.meow, 1000)
    }

    this.meow = function(){
        this.timesSaid++;
        alert("Meow!")
    }
}

However, I keep getting this.timesSaid as undefined. I assume it has to do with me calling it via setTimeout.

How do i work around this problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.