<?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: &#8220;Appearances can be deceiving Mr. Anderson&#8221; &#8211; a.k.a. short code is not always fast code</title>
	<atom:link href="http://lea.verou.me/2009/02/appearances-can-be-deceiving-mr-anderson-aka-short-code-is-not-always-fast-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://lea.verou.me/2009/02/appearances-can-be-deceiving-mr-anderson-aka-short-code-is-not-always-fast-code/</link>
	<description>Life at the bleeding edge (of web standards)</description>
	<lastBuildDate>Fri, 10 Feb 2012 07:25:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Lea Verou</title>
		<link>http://lea.verou.me/2009/02/appearances-can-be-deceiving-mr-anderson-aka-short-code-is-not-always-fast-code/#comment-11</link>
		<dc:creator>Lea Verou</dc:creator>
		<pubDate>Thu, 26 Feb 2009 02:41:23 +0000</pubDate>
		<guid isPermaLink="false">http://leaverou.me/?p=182#comment-11</guid>
		<description>@Kean: Thanks for commenting and for the kind words! You made my day! :D

As for the instanceof check, it&#039;s good for some type checks (eg. Arrays in single-frame environments, as you already mentioned), but for I omitted it on purpose here, since this post only deals with String and Number checks, and instanceof doesn&#039;t seem very reliable for these. 
Just type in your firebug console the following:
&lt;pre&gt;&#039;foo&#039; instanceof String; // yields false
5 instanceof Number; //yields false&lt;/pre&gt;

On the contrary, instanceof yields true for non-primitive String and Number objects:
&lt;pre&gt;new String(&#039;foo&#039;) instanceof String; // yields true
new Number(5) instanceof Number; //yields true&lt;/pre&gt;

I&#039;m not sure why that happens but it seems instanceof is not suitable for robust String and Number type checks.

By the way, your comment inspired me to add another paragraph to the original article. :)</description>
		<content:encoded><![CDATA[<p>@Kean: Thanks for commenting and for the kind words! You made my day! <img src='http://lea.verou.me/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>As for the instanceof check, it&#8217;s good for some type checks (eg. Arrays in single-frame environments, as you already mentioned), but for I omitted it on purpose here, since this post only deals with String and Number checks, and instanceof doesn&#8217;t seem very reliable for these.<br />
Just type in your firebug console the following:</p>
<pre>'foo' instanceof String; // yields false
5 instanceof Number; //yields false</pre>
<p>On the contrary, instanceof yields true for non-primitive String and Number objects:</p>
<pre>new String('foo') instanceof String; // yields true
new Number(5) instanceof Number; //yields true</pre>
<p>I&#8217;m not sure why that happens but it seems instanceof is not suitable for robust String and Number type checks.</p>
<p>By the way, your comment inspired me to add another paragraph to the original article. <img src='http://lea.verou.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kean</title>
		<link>http://lea.verou.me/2009/02/appearances-can-be-deceiving-mr-anderson-aka-short-code-is-not-always-fast-code/#comment-10</link>
		<dc:creator>Kean</dc:creator>
		<pubDate>Thu, 26 Feb 2009 02:31:04 +0000</pubDate>
		<guid isPermaLink="false">http://leaverou.me/?p=182#comment-10</guid>
		<description>Nice article, all your posts have depth and are pretty well researched.

There&#039;s another method to detect object by using instanceof but it&#039;s not very reliable. For example ([1,2,3] instanceof Array) and ([1,2,3].constructor === Array) returns true only when the variable is in the same frame/iframe.

Object.prototype.toString.call is good for detecting types that typeof  sucks at such as Object, Array and Date. Consider this,  typeof [], typeof {} and typeof (new Date()) returns &quot;object&quot;.

Just use the right function to do the job; sometimes you&#039;d have to sacrifice some speed to achieve reliability.</description>
		<content:encoded><![CDATA[<p>Nice article, all your posts have depth and are pretty well researched.</p>
<p>There&#8217;s another method to detect object by using instanceof but it&#8217;s not very reliable. For example ([1,2,3] instanceof Array) and ([1,2,3].constructor === Array) returns true only when the variable is in the same frame/iframe.</p>
<p>Object.prototype.toString.call is good for detecting types that typeof  sucks at such as Object, Array and Date. Consider this,  typeof [], typeof {} and typeof (new Date()) returns &#8220;object&#8221;.</p>
<p>Just use the right function to do the job; sometimes you&#8217;d have to sacrifice some speed to achieve reliability.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

