Looping through multiple variables in a function
<p>I've written a function that contains an if statement and the condition contains a variable. </p>

<pre><code>    function interval() {
        var interval = setInterval(function() {
            if (x &lt; max) {
                x = parseInt(x) + 1;
                $('.max').html(addCommas(x));
            }
        }, 1);
    };   
</code></pre>

<p>So here <em>max</em> is my variable. Works great, but now I have three more variables and I want to run the same function but with the different variables each time. I could copy the function 3 more times and edit the variable in each one but that strikes me as highly inefficient. </p>

<p>What would be the best way to achieve this Stacked?</p>
