What Javascript types can have properties?
<p>Given var x, what is the best  way to determine if x can have properties? Can I just do </p>

<blockquote>
  <p>if(x instanceof Object)</p>
</blockquote>

<p>Is that sufficient to ensure that x can have properties or do I need to check for anything else? I know primitives can't have properties but is there anything else? I've been going through checking various types:</p>

<pre><code>var a = false;
a.foo = "bar";
console.log(a["foo"]);
// Logs undefined

var b = "b";
b.foo = "bar";
console.log(b["foo"]);
// Logs undefined

var c = new Array(1,2,3);
c.foo = "bar";
console.log(c["foo"]);
// Logs bar

var d = new Object();
d.foo = "bar";
console.log(d["foo"]);
// Logs bar

var e = new RegExp("");
e.foo = "foo";
console.log(e["bar"]);
// Logs bar

var f = new Number(1);
f.foo = "bar";
console.log(f["foo"]);
// Logs bar

var g = function(){};
g.foo = "bar";
console.log(g["foo"]);
// Logs bar
</code></pre>

<p>etc..</p>
