Determining the type of an object in JavaScript
<p>I have a mystery object in Javascript - please could someone tell me how to initialise a similar object?</p>

<p>Background: I've inherited some code that gets passed a <code>params</code> object from Flash. I want to 'fake' the same call, which requires manually constructing the same object. But I can't work out how to take it, because I don't know what type of object it is. (It's not the <em>content</em> that's the problem: it's <em>how</em> to initialise the object.)</p>

<p>Please could someone tell me whether the <code>params</code> object following is an array, a list, a hash or something else - or at least how I can work it out for myself, given that there is no <code>typeof</code> in JavaScript?</p>

<pre><code>function doSomething(params) {
    var txt;
    for (p in params) {
       txt = txt + "param:" + p + ", " + params[p] + "\n";
    }
    return txt;
}
</code></pre>

<p>Thanks!</p>
