Difference between revisions of "Sandbox"
From Organic Design wiki
m |
|||
| Line 4: | Line 4: | ||
var closure = ( function() { | var closure = ( function() { | ||
| − | |||
return { | return { | ||
| − | + | foo: function() { | |
| − | + | private = 'secret message'; | |
| − | + | public = 'not secret'; | |
| + | } | ||
| + | bar: function() { | ||
| + | alert( private ); | ||
} | } | ||
} | } | ||
} )(); | } )(); | ||
| − | closure. | + | alert( closure.public ); |
| − | alert( closure. | + | alert( closure.private ); |
| − | + | closure.bar(); | |
}); | }); | ||
</script></html> | </script></html> | ||
Revision as of 15:27, 12 September 2012



