[Javascript] function object/custom object prototype confusion

liorean liorean at gmail.com
Wed Apr 13 15:46:46 CDT 2005


On 4/13/05, james <james at southspace.org> wrote:
> // ???
> Person.prototype.toString() {
>      return this.first + " " + this.last;
> }

> but, I get an error for the line beginning Person.prototype.toString()
> which looks wrong to me anyway (is a function or object literal?)


> can anyone with a bit more experience just take a quick peak and put my out
> of my doubtful misery?

It's wrong. It should be like this:

    Person.prototype.toString=function(){
        return this.first + " " + this.last;
    };
-- 
David "liorean" Andersson
<uri:http://liorean.web-graphics.com/>



More information about the Javascript mailing list