JSFiddle - React, Tailwind, and code Playground

by jessekinsman

JavaScript

var jspy = (function() {
  
    var _count = 0;

  var incrementCount = function() {
    _count++;
  }

  var getCount = function() {
    return _count;
  }
  return {
    incrementCount: incrementCount,
    getCount: getCount
  };

})();

for (var i=3; i>=0; i--) {
jspy.incrementCount();
    alert(i);
}

    alert(jspy.getCount());