Skip to content

Instantly share code, notes, and snippets.

@crecotun
Last active August 29, 2015 14:22
Show Gist options
  • Save crecotun/6831d662902203d75436 to your computer and use it in GitHub Desktop.
Save crecotun/6831d662902203d75436 to your computer and use it in GitHub Desktop.
Patterns
// Self invoking object
({
default: "Default",
init: function(name) {
var name = name ? name : this.default
console.log( "Hi, " + name );
}
}).init('Alex')
// self invoking function
(function(name) {
var name = name ? name : 'Default';
console.log( 'Hi, ' + name );
})('Alex');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment