<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Checking types in JavaScript</title>
	<atom:link href="http://james.padolsey.com/javascript/checking-types-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://james.padolsey.com/javascript/checking-types-in-javascript/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 02 Feb 2012 18:03:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: GeekFG</title>
		<link>http://james.padolsey.com/javascript/checking-types-in-javascript/comment-page-1/#comment-3005</link>
		<dc:creator>GeekFG</dc:creator>
		<pubDate>Wed, 14 Jan 2009 10:38:13 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=408#comment-3005</guid>
		<description>That&#039;s why a added this link &quot;http://docs.jquery.com/JQuery_Core_Style_Guidelines&quot;.
When I want to check for an array I use jQuery.isArray(object).

Moreover Object.prototype is a better way for browsers compatibility than window[key] = function(){}</description>
		<content:encoded><![CDATA[<p>That&#8217;s why a added this link &#8220;http://docs.jquery.com/JQuery_Core_Style_Guidelines&#8221;.<br />
When I want to check for an array I use jQuery.isArray(object).</p>
<p>Moreover Object.prototype is a better way for browsers compatibility than window[key] = function(){}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://james.padolsey.com/javascript/checking-types-in-javascript/comment-page-1/#comment-3002</link>
		<dc:creator>James</dc:creator>
		<pubDate>Wed, 14 Jan 2009 09:17:48 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=408#comment-3002</guid>
		<description>@GeekFG, did you read my post (or any of the other comments)? Typeof is okay for most cases but it reports certain types incorrectly. For example, this won&#039;t work:

&lt;pre lang=&quot;javascript&quot;&gt;
alert( typeof [1,2,3,4,5] ); // This should alert &#039;Array&#039;, not &#039;Object&#039;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@GeekFG, did you read my post (or any of the other comments)? Typeof is okay for most cases but it reports certain types incorrectly. For example, this won&#8217;t work:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span class="kw3">alert</span><span class="br0">&#40;</span> <span class="kw1">typeof</span> <span class="br0">&#91;</span><span class="nu0">1</span><span class="sy0">,</span><span class="nu0">2</span><span class="sy0">,</span><span class="nu0">3</span><span class="sy0">,</span><span class="nu0">4</span><span class="sy0">,</span><span class="nu0">5</span><span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// This should alert 'Array', not 'Object'</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: GeekFG</title>
		<link>http://james.padolsey.com/javascript/checking-types-in-javascript/comment-page-1/#comment-3001</link>
		<dc:creator>GeekFG</dc:creator>
		<pubDate>Wed, 14 Jan 2009 09:11:09 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=408#comment-3001</guid>
		<description>Why did you not simply use typeOf (http://docs.jquery.com/JQuery_Core_Style_Guidelines) ?</description>
		<content:encoded><![CDATA[<p>Why did you not simply use typeOf (<a href="http://docs.jquery.com/JQuery_Core_Style_Guidelines">http://docs.jquery.com/JQuery_Core_Style_Guidelines</a>) ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gman</title>
		<link>http://james.padolsey.com/javascript/checking-types-in-javascript/comment-page-1/#comment-2985</link>
		<dc:creator>Gman</dc:creator>
		<pubDate>Wed, 14 Jan 2009 02:58:48 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=408#comment-2985</guid>
		<description>@James
ya, now I got it. Thank you</description>
		<content:encoded><![CDATA[<p>@James<br />
ya, now I got it. Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Townsend</title>
		<link>http://james.padolsey.com/javascript/checking-types-in-javascript/comment-page-1/#comment-2891</link>
		<dc:creator>Ryan Townsend</dc:creator>
		<pubDate>Mon, 12 Jan 2009 19:37:43 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=408#comment-2891</guid>
		<description>Paul, those guidelines do prevent use of a switch() condition though, for better code-readability James&#039; method works nicely.</description>
		<content:encoded><![CDATA[<p>Paul, those guidelines do prevent use of a switch() condition though, for better code-readability James&#8217; method works nicely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://james.padolsey.com/javascript/checking-types-in-javascript/comment-page-1/#comment-2890</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Mon, 12 Jan 2009 19:35:39 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=408#comment-2890</guid>
		<description>nice idea</description>
		<content:encoded><![CDATA[<p>nice idea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Irish</title>
		<link>http://james.padolsey.com/javascript/checking-types-in-javascript/comment-page-1/#comment-2888</link>
		<dc:creator>Paul Irish</dc:creator>
		<pubDate>Mon, 12 Jan 2009 18:48:04 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=408#comment-2888</guid>
		<description>just for reference, here are the official recommendations for doing these in jQuery: http://docs.jquery.com/JQuery_Core_Style_Guidelines</description>
		<content:encoded><![CDATA[<p>just for reference, here are the official recommendations for doing these in jQuery: <a href="http://docs.jquery.com/JQuery_Core_Style_Guidelines">http://docs.jquery.com/JQuery_Core_Style_Guidelines</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://james.padolsey.com/javascript/checking-types-in-javascript/comment-page-1/#comment-2883</link>
		<dc:creator>James</dc:creator>
		<pubDate>Mon, 12 Jan 2009 17:36:54 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=408#comment-2883</guid>
		<description>Hi Gman! 

&#039;===&#039; is known as the &lt;em&gt;strict&lt;/em&gt; equality operator. It is normally used instead of the well known general equality operator (&#039;==&#039;). The only difference is that the former checks for type and the latter doesn&#039;t. It&#039;s best practice to use the strict version for that very reason.

An example:

&lt;pre lang=&quot;javascript&quot;&gt;
var realNumber = 999;
var numberInString = &#039;999&#039;;

realNumber == numberInString; // TRUE
realNumber === numberInString; // FALSE
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Gman! </p>
<p>&#8216;===&#8217; is known as the <em>strict</em> equality operator. It is normally used instead of the well known general equality operator (&#8216;==&#8217;). The only difference is that the former checks for type and the latter doesn&#8217;t. It&#8217;s best practice to use the strict version for that very reason.</p>
<p>An example:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span class="kw2">var</span> realNumber <span class="sy0">=</span> <span class="nu0">999</span><span class="sy0">;</span>
<span class="kw2">var</span> numberInString <span class="sy0">=</span> <span class="st0">'999'</span><span class="sy0">;</span>
&nbsp;
realNumber <span class="sy0">==</span> numberInString<span class="sy0">;</span> <span class="co1">// TRUE</span>
realNumber <span class="sy0">===</span> numberInString<span class="sy0">;</span> <span class="co1">// FALSE</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Gman</title>
		<link>http://james.padolsey.com/javascript/checking-types-in-javascript/comment-page-1/#comment-2881</link>
		<dc:creator>Gman</dc:creator>
		<pubDate>Mon, 12 Jan 2009 17:27:52 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=408#comment-2881</guid>
		<description>what does &quot;===&quot; mean?</description>
		<content:encoded><![CDATA[<p>what does &#8220;===&#8221; mean?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

