Last active
August 29, 2015 14:22
-
-
Save crecotun/6831d662902203d75436 to your computer and use it in GitHub Desktop.
Patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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