Javascript Object to String Using toSource (Mozilla Only)

Javascript
Sep 27 2016
1274 Views

Javascript Object to String Using toSource (Mozilla Only)

View demo

Problem:

Typically if we just use alert (object) it will be show as "element object". How to print all the content parameters of an object in JavaScript?

 

Simple Solution:

alert(object.toSource());

 

If you use firebug

If you want to print the object for debugging purposes, I suggest instead installing Firebug for Firefox and using the code:

console.log(object);

Leave a Reply