I want to see the value of obj,following code is used
var obj = {
x: 'abc',
y: 2,
z: 3
};
When I use alert(obj) it just gives me [object Object]. When I use console.log(obj) it shows the object in console correctly
why this alert function cant shows the object as it is...???
is there anymore data types that alert function cant show correcly
alert()accepts string argument, so not sure what you are expecting. What is wrong with usingconsole.log()that is preferred method for getting at debug information.alert(toString.call(obj));is essentially what you are seeing.