How can I create static variables in Javascript?
There are other similar answers, but none of them quite appealed to me. Here's what I ended up with:
var nextCounter = (function () { var counter = 0; return function() { var temp = counter; counter += 1; return temp; }; })();