Tired of running wrapper function manually? Interested to run it automatically? You're in the right place.
In JavaScript, you can simply run some function manually with this :
Which is really annoying, for me.. and maybe for you. So, let's get rid of it.
Anonymous Function
So, we would need to use Anonymous Function in this time. It would run immediately because of the Anonymous Function.
Let's wrap this, why don't you:
It must self-destruct itself. Or if you want it to be named..
It should work.
In JavaScript, you can simply run some function manually with this :
- Code:
function selfDestruct() {
alert('Self Destruct');
}
selfDestruct();
Which is really annoying, for me.. and maybe for you. So, let's get rid of it.
Anonymous Function
So, we would need to use Anonymous Function in this time. It would run immediately because of the Anonymous Function.
Let's wrap this, why don't you:
- Code:
(function() {
alert('Self Destruct');
})();
It must self-destruct itself. Or if you want it to be named..
- Code:
(function foo() {
alert('Self Destruct example');
})();
It should work.