javascript - self execute function is not a function error -
var module = (function () { console.log('hello world'); }());
the above function did work upon loading, means did self executed. when want run second time, wrote module()
, doesn't work, why? don't want paste entire function body run again..
i tried on angularjs btw, either $scope.moudule()
or module()
work me.
self-execute result of attribution, you're storing result of self execution (in case nothing).
try this:
(module = function () { console.log('hello world'); })();
Comments
Post a Comment