Result of expression 'xxxx' is not a constructor in JS

Posted by Pselus on Stack Overflow See other posts from Stack Overflow or by Pselus
Published on 2011-01-09T15:30:35Z Indexed on 2011/01/09 15:53 UTC
Read the original article Hit count: 205

Filed under:
|

Trying to create an object in Javascript (for Appcelerator/Titanium). The "object" is defined like this:

function server () {
    this.cacheimages = 0;
    this.login = "";
    this.name = "";
    this.root = "";
    this.signup = "";
    this.useimages = 0;
    this.userexists = "";
    this.isdefault = 0;

    return this;
}

In the same file, in another function when I run this line: var server = new server(); I get the error Result of expression 'server' is not a constructor.
I have tried it with and without the "return" line, neither work. What am I doing wrong?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about appcelerator