Object's value and prototype issue
<p>I'm trying to create a new class, but it doesn't seem to be working. Here's the code:</p>

<pre><code>&lt;script&gt;
var myClass = function(arg){
    return new init(arg);
}
var init = function(arg){
    return arg;
}
init.prototype.prop = true;
&lt;/script&gt;
</code></pre>

<p>The problem is that <code>myClass('foo')</code> doesn't return <code>'foo'</code> as expected. Instead, it returns <code>init</code>.
Then I tried this code:</p>

<pre><code>var init = function(arg){
    return [arg];//Now init returns an array
}
</code></pre>

<p>The <code>myClass('foo')</code> returns <code>['foo']</code>, but then <code>myClass('foo').prop</code> turns into <code>undefined</code>. Does anyone know how to solve it?</p>

<p>EDIT: I want to create this class more or less as jQuery does.
For example: <code>$('div')</code> returns directly a value (in case, all div tags), but not an object with a property that stores this values</p>
