Skip to content

Instantly share code, notes, and snippets.

@Lin4ipsum
Created August 1, 2013 14:51
Show Gist options
  • Save Lin4ipsum/6132129 to your computer and use it in GitHub Desktop.
Save Lin4ipsum/6132129 to your computer and use it in GitHub Desktop.
ex/ javascript revealing module pattern
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