Is there any method to change the priority of the two assignment methods?
<p>This is an interview questions, Asked to write a <code>Man</code> class to let the following code can run properly:</p>

<pre><code>var me =new  Man();

//method one:
me.attr("fullname", "tom");

//method two:
me.fullname = "jim";

console.info("my name is:" + me.attr("fullname"));

/*------[result is]------
my name is:tom
------------------*/
</code></pre>

<p>my answer is:</p>

<pre><code>var Man=function(){
};

Man.prototype.attr=function(attr,val){
    if(val){
        this[attr]=val;
    }
    else{
        return this[attr];
    }
}
</code></pre>

<p>The results of my code to run is:</p>

<pre><code>/*------[result is]------
my name is:jim
------------------*/
</code></pre>

<p>who can help me? thanks</p>
