Created
January 20, 2016 19:42
-
-
Save verekia/92c0ae3f09a7cd2de5db to your computer and use it in GitHub Desktop.
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
var MyMath = (function(){ | |
// With this pattern you can use the usual function notation: | |
function add(a, b){ | |
return a + b; | |
} | |
return { | |
add:add // But don't forget to declare it in the returned object! | |
}; | |
})(); | |
console.log(MyMath.add(1, 2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment