Skip to content

Instantly share code, notes, and snippets.

@sheppardjm
Created October 20, 2022 23:51
Show Gist options
  • Save sheppardjm/6ed88e16f34c11fc77de50ec2fd90881 to your computer and use it in GitHub Desktop.
Save sheppardjm/6ed88e16f34c11fc77de50ec2fd90881 to your computer and use it in GitHub Desktop.
Javascript Immediate invocation
//example declaration
(function() {
//do something
})();
//alternative declaration
(function() {
//do something
}());
//passing parameters
(function(a, b) {
//do something
})(some, values);
//return something
let x = (function(a, b) {
//do something
})(some, values);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment