Function with a state

An example showing how to create function with a state using Tizen 2.3.
1
2
3
4
5
6
7
8
9
10
11
12
13
var functionWithState = (function() {
  var state = 0;
  return function() {
    return state++;
  };
}());
functionWithState(); // 0
functionWithState(); // 1
functionWithState(); // 2
functionWithState(); // 3
functionWithState(); // 4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX