I have made my custom object and I want to add a method into. I want to uppercase my values. But it is giving me [object object].Any idea how to get it done. fiddle
function checkObj (name,title,salary){
this.name= name;
this.title= title;
this.salary= salary;
}
var woo=new checkObj("rajora","this is a test",2000);
checkObj.prototype.inc=function (){
for(i=0;i<this.length;i++){
this[i]= this[i].toUpperCase();
}
};
woo.inc();
console.log(woo)
console.log(woo)?wooit's your objectconsole.log(JSON.stringify(woo))(in your case)