JavaScript Object constructor not showing stable value
<p>I have a js code as follows,</p>

<pre><code>   function findDealerByIdResponse() {
findDealerByIdResponse.prototype = findDealerByIdResponseType;


this.getPrefix = function(){
        return "tns1";
};
this.getNS = function(){
    return "http://www.hp.com/bookservice";
};

} 

function findDealerByIdResponseType(){
var DEALER ;


this.getPrefix = function(){
        return "tns1";
};
this.getNS = function(){
    return "http://www.hp.com/bookservice";
};


}

function getName( obj ) { 

   var funcNameRegex = /function (.{1,})\(/;
   var results = new Object();
   results = (funcNameRegex).exec((obj).constructor.toString());
   return (results &amp;&amp; results.length &gt; 1) ? results[1] : "";
};

function test(){
var req = new findDealerByIdResponse();
alert(getName(req));
}
</code></pre>

<p>But If i perform "test" first time it is giving what i expected : "doTransactionType" . But afterwards it is giving "Function" . Please explain the reason.</p>

<p>Thanks</p>

<p>Deepak</p>
