why does this return undefined - javascript
<p>i'm pretty new to js. i'm sorry if this sounds dumb.
but why does the following code return "undefined"</p>

<pre><code>function NewPerson(name, age, sex){
    this.name = name;
    this.age = age;
    this.sex = sex;

    this.getName = function(){
        //alert(this.name);
        alert("The age is "+this.age);
    };

}

var obj1 = new NewPerson("Mark",25,"Male");
alert("The age is as follows "+obj1.getName());
</code></pre>

<p>// output:</p>

<p>The age is 25
The age is as follows undefined</p>
