-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.html
33 lines (30 loc) · 882 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Getting started - Revealing module pattern</title>
</head>
<body>
<h1>See browser console for example output.</h1>
<script>
var revealingModule = (function() {
var innerObject = 5;
var innerFunction = function(value) {
return innerObject + value;
};
return {
outerObject1: innerFunction(1),
outerObject2: innerFunction(2),
outerFunction: innerFunction
};
}());
console.log("outerObject1:" + revealingModule.outerObject1);
console.log("outerObject2:" + revealingModule.outerObject2);
console.log("innerObject:" + revealingModule.innerObject);
console.log("outerFunction(3):" +
revealingModule.outerFunction(3));
console.log("innerFunction(3):" +
revealingModule.innerFunction(3));
</script>
</body>
</html>