<pre><code>&quot;foo&quot; instanceof String //=&gt; false
&quot;foo&quot; instanceof Object //=&gt; false

true instanceof Boolean //=&gt; false
true instanceof Object //=&gt; false
false instanceof Boolean //=&gt; false
false instanceof Object //=&gt; false

12.21 instanceof Number //=&gt; false
/foo/ instanceof RegExp //=&gt; true

// the tests against Object really don't make sense
</code></pre>
<p>Array literals and Object literals match...</p>
<pre><code>[0,1] instanceof Array //=&gt; true
{0:1} instanceof Object //=&gt; true
</code></pre>
<p>Why don't all of them? Or, why don't they all <em>not</em>?<br />
And, what are they an instance of, then?</p>
<p>It's the same in FF3, IE7, Opera, and Chrome. So, at least it's consistent.</p>

Primitives are a different kind of type than objects created from within Javascript. From the
Mozilla API docs
:
```
```
var color1 = new String("green");
color1 instanceof String; // returns true
var color2 = "coral";
color2 instanceof String; // returns false (color2 is not a String object)
```
```
I can't find any way to construct primitive types with code, perhaps it's not possible. This is probably why people use
```
typeof "foo" === "string"
```
instead of
```
instanceof
```
.
An easy way to remember things like this is asking yourself "I wonder what would be sane and easy to learn"? Whatever the answer is, Javascript does the other thing.