1var something = (function() {
2 var executed = false;
3 return function() {
4 if (!executed) {
5 executed = true;
6 // do something
7 }
8 };
9})();
10
11something(); // "do something" happens
12something(); // nothing happens
13