Skip to content

Instantly share code, notes, and snippets.

!(function(){console.log('Hello, World!')})();
!function(){console.log('Hello, World!')}();
(function() {
console.log('Hello, World!');
})();
var foo = (function foo(x) {
return x * 10;
});
var foo = function foo(x) {
return x * 10;
};
function foo(x) {
return x * 10;
}
var myModule = (function() {
// The whole logic of my module
// Return the module object
})();
function foo() {
function bar(x) {
return x + 10;
}
function baz(x, y) {
return x + y;
}
console.log(baz(100, 200));
function foo(x) {
if (x > 10) {
var a = 2;
return a * x;
}
return x + 10;
}