I am trying to increment a counter, but I would like to move the variable out of the global namespace and declare it locally. I’m not sure how to do this. Thanks for your help.
This is the code I’m using at the moment.
var mediaClickCounter = 0;
function refreshMediaAds() {
if (mediaClickCounter < 2) {
mediaClickCounter++;
} else {
mediaClickCounter = 0;
refreshAds();
}
}
Closures <3.