A attempt to port the php function print_r to javascript and jQuery. It simply returns a nested string containing information about the passed object.
Strings
Numbers
Booleans
Dates
Arrays
Objects
jQuery Objects
RegExp
Errors
DOMElements
Functions
<pre id="dump"></pre> <script type="text/javascript"> $(document).ready(function(){ var obj = { hubba: "Some string...", bubba: 12.5, dubba: ["One", "Two", "Three"] } $("#dump").append($.dump(obj)); }); </script>
Should result in:
Object { hubba: "Some string..." bubba: 12.5 dubba: Array ( 0 => "One" 1 => "Two" 2 => "Three" ) }
`
Hubba bubba dubba
jQuery Object { 0 = DOMElement [ nodeName: P nodeValue: null innerHTML: [ 0 = String: Hubba 1 = DOMElement [ nodeName: SPAN nodeValue: null innerHTML: [ 0 = String: bubba ] ] 2 = String: dubba ] ] }