This question already has an answer here:
- How can I display a JavaScript object? 35 answers
Typically if we just use alert(object);
it will show as [object Object]
. How to print all the content parameters of an object in JavaScript?
This question already has an answer here:
Typically if we just use alert(object);
it will show as [object Object]
. How to print all the content parameters of an object in JavaScript?
If you are using Firefox,
alert(object.toSource())
should suffice for simple debugging purposes.Javascript for all!
You can also use Prototype's Object.inspect() method, which "Returns the debug-oriented string representation of the object".
http://api.prototypejs.org/language/Object/inspect/