Created
August 1, 2013 14:51
-
-
Save Lin4ipsum/6132129 to your computer and use it in GitHub Desktop.
ex/ javascript revealing module pattern
This file contains hidden or 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 calculator = function() { | |
var numbers = [4,2,5,7], | |
sum = 0 | |
var getSum = function() { | |
for(var x = 0; x < numbers.length; x++){ | |
sum += numbers[x]; | |
} | |
return sum; | |
}; | |
var sayHello = function() { | |
console.log("HIIiiii"); | |
} | |
sayHello(); | |
return { | |
title: "sum up numbers", | |
sumfn: getSum, | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment