Storing setInterval as object property
<p>So I'd like to store setInterval as an object property because I often like to use the phrase "autoPlay" to describe a rotator that starts immediately. When I use "autoPlay" more than once in a series of scripts, my JS gets tripped up when I try to clear them, because it's not sure which one to clear. My remedy is to put it somewhere as a property, so I can access it through an object, like "newsRotator.autoPlay". The problem is, I'm not sure how to store it that way, since it usually gets placed in a basic variable like so:</p>

<pre><code>autoPlay = setInterval(this.forwardSlide, 5000);
</code></pre>

<p>This is an example one of my attempts at storing it as an object property, which fails to clear the interval:</p>

<pre><code>var newsRotator = {
    run: function () {
        $('.arrow').on('click', function (e) {
            e.preventDefault();
            clearInterval(newsRotator.autoPlay);
            if ($(this).hasClass('back')) {
                newsRotator.backSlide();
            } else {
                newsRotator.forwardSlide();
            }
        });
    },
    backSlide: function () {
        (goes back one slide)
    },
    forwardSlide: function () {
        (goes forwardone slide)
    },
    autoPlay: setInterval(this.forwardSlide, 5000),
    init: function () {
        this.run();
    }
}

newsRotator.init()
</code></pre>
