function returns undefined in some pages
<p>I load a javascript file asynchronously and the file contains this line defined within a plugin defaults. It returns correct return value in some pages whereas in other pages the same file returns 'undefined' values. Any pointers?</p>

<pre><code>login: '&lt;p&gt;Log in with your '+ fnc(code).name +' account&lt;/p&gt;'
</code></pre>

<p>somewhere at the bottom of the same file I have defined the function:</p>

<pre><code> function fnc(s){
      if(s =='' || s == 'a'){
        this.name = 'name1';
        this.value = 'value1';
      }else if(s == 'b'){
        this.name = 'name2';
        this.value = 'value2';
      }else{
        this.name = 'name1';
        this.value = 'value1';
       }
      return this;
    }
</code></pre>

<p>For some reason, the function returns 'undefined' </p>

<p>UPDATE: "code" is a global variable that is present in some other file, depending on the value of that variable, I want to return different values from the function</p>

<p>UPDATE2: I want to return multiple values from the function, updated the code to reflect that.</p>
