i want to do something like this,
function MyObject(args){
keys=Object.getOwnPropertyNames(args)
keys.forEach(function(key){
this[key]=args[key]
})
}
after this i tried creating an object, but it's attributes were not set..
n=new MyObject({title:'x',age:19})
console.log(n.title)
OutPut:undefined!!
so can anyone tell me what im doing wrong...i even tried replaced this[key] with MyObject[key], but got same result..
thiswill refer to the wrong object