How can we display a JavaScript object?
If we want to print the object for debugging purposes, we suggest instead installing Firebug for Firefox and using the code:
console.log(obj)
Use native JSON.stringify
method. Works with nested objects and all major browsers support this method.
If we want to use alert, to print your object, we can do this:
It should print each property and its corresponding value in string format.
Function: