Select the following Topics you are interested
Javascript Example is extracted from article "Javascript function closures and design of encapsulated javascript object and class " from Cloudgen's Javascript Laboratory
There is no detailed explanation for this example.
<script type="text/javascript">
function closures(obj, name){
var data;
obj["get"+name]=function(){return data}
obj["set"+name]=function(e){data=e}
}
a={};
closures(a,"Data");
a.setData("abc");
document.write("a="+a.getData()+"<"+"br/>");
</script>
Output: