new ecmascript 5 inheritance pattern
by rishul matta
JavaScript
function A(){
this.name="dude";
var test="i am private";
this.getTest=function(){
return test;
};
this.setTest=function(val){
test=val;
}
}
var b={
name:"yo am in b",
test:function(){
return "i am in b";
}
};
var obj= Object.create(b,{
childName:{
value:"i am child name of obj",
writable:true
}
});
var obj2= Object.create(b,{
childName:{
value:"i am child name of obj2",
writable:true
}
});
alert(obj.childName===obj2.childName)
//alert(obj.getTest());
//alert(obj.setTest("i have changed"));
//alert(obj.getTest());