<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Antoine &#187; print_r</title>
	<atom:link href="http://www.chrisantoine.net/tag/print_r/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrisantoine.net</link>
	<description>PHP / MySQL / JavaScript / Ajax Development.</description>
	<lastBuildDate>Fri, 13 Nov 2009 03:11:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JavaScript print_r()</title>
		<link>http://www.chrisantoine.net/2008/05/02/javascript-print_r/</link>
		<comments>http://www.chrisantoine.net/2008/05/02/javascript-print_r/#comments</comments>
		<pubDate>Sat, 03 May 2008 00:23:42 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[print_r]]></category>

		<guid isPermaLink="false">http://www.chrisantoine.net/?p=18</guid>
		<description><![CDATA[If you are anything like me I constantly fight with having an object/array in JS and I want to see what all of its properties are.  I ran into this the other day and decided to actually find a solution to the problem of not knowing what properties there are for an event.  [...]]]></description>
			<content:encoded><![CDATA[<p>If you are anything like me I constantly fight with having an object/array in JS and I want to see what all of its properties are.  I ran into this the other day and decided to actually find a solution to the problem of not knowing what properties there are for an event.  While doing some searching I came across <a title="brandnewbox.co.uk" href="http://www.brandnewbox.co.uk/logbook/article/a_print_r_equivalent_for_javascript/" target="_blank">this</a> site.  It has been a great solution to what I needed.  The code is as follows:</p>
<pre>   <code class="javascript">
function print_r(theObj){
   if(theObj.constructor == Array || theObj.constructor == Object){
      document.write("&lt;ul&gt;")
      for(var p in theObj){
         if(theObj[p].constructor == Array || theObj[p].constructor == Object){
            document.write("&lt;li&gt;["+p+"] => "+typeof(theObj)+"&lt;/li&gt;");
            document.write("&lt;ul&gt;")
            print_r(theObj[p]);
            document.write("&lt;/ul&gt;")
         } else {
            document.write("&lt;li&gt;["+p+"] => "+theObj[p]+"&lt;/li&gt;");
         }
      }
      document.write("&lt;/ul&gt;")
   }
}
 </code></pre>
<p>Its a pretty simple little snippet of code but was VERY handy for me while troubleshooting an event problem and having to deal with each individual browser as each of them have different event properties.  Hope it helps someone else.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisantoine.net/2008/05/02/javascript-print_r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
