var something = (function() {
var executed = false;
return function() {
if (!executed) {
executed = true;
// do something
}
};
})();
something(); // "do something" happens
something(); // nothing happens
function myFunction() {
let value = 1 // change to random value
if(document.getElementById("myId").innerHTML = value) {
// do something
myFunction == function(){}; // emptying my function after it is run once
}}