How to instantiate a javascript class in another js file?
<p>Suppose if i define a class in file1.js</p>

<pre><code>function Customer(){
this.name="Jhon";
this.getName=function(){
return this.name;
};
};
</code></pre>

<p>Now if i want to create a customer object in file2.js</p>

<pre><code>var customer=new Customer();
var name=customer.getName();
</code></pre>

<p>I am getting exception: Customer is undefined, not a constructor.</p>

<p>But when i create a customer object in file2.js and pass it to file1.js then its working .</p>

<pre><code>file1.js

    function Customer(){
    this.name="Jhon";
    this.getName=function(){
    return this.name;
    }
    }
    function customer(){
    return new Customer();
    }

    file2.js

    var customer=customer();
    var name=customer.getName();
</code></pre>

<p>but i want to create a customer object in file1.js using new Customer(). How can i achieve that?  </p>
