How do Javascript objects work?
<h2>Preface</h2>

<ol>
<li>I know the right code for these examples.</li>
<li>What I want to know is <em>why</em> the following examples won't work as expected.</li></li>
</ol>

<h2>Code</h2>

<ul>
<li><p>With parentheses when calling <code>sayIt</code> function.</p>

<pre><code>function Fruit(type){
    this.type = type;
    this.taste = "Awful";
    this.thought = sayIt();
}

function sayIt(){
    return this.taste+" "+ this.type;
}

window.onload = function (){
    var lemon= new Fruit("Lemon");
    alert(lemon.thought);
};
</code></pre>

<p>This will alert "undefined undefined", why?</p></li>
<li><p><code>sayIt</code> function without parentheses.</p>

<pre><code>function Fruit (type){
    this.type = type;
    this.taste = "Awful";
    this.thought = sayIt;
}

function sayIt(){
    return this.taste +" "+ this.type;
}

window.onload = function (){
    var lemon= new Fruit("Lemon");
    alert(lemon.thought);
};
</code></pre>

<p>This will literally write down the function on the alert box, why?</p></li>
</ul>

<p>Thank you in advance.</p>
