Javascript Function Definitions

Posted by Pierreten on Stack Overflow See other posts from Stack Overflow or by Pierreten
Published on 2010-05-07T18:12:36Z Indexed on 2010/05/07 18:18 UTC
Read the original article Hit count: 125

Filed under:
|

I was wondering why the Vector variable defined within this self executing javascript function doesn't require a var before it? Is this just some other type of syntax for creating a named function? Does this make it so we can't pass Vector as an argument to other functions?

(function() {
    Vector = function(x, y) {
        this.x = x;
        this.y = y;

        return this;
    };

   //...snip   
})()

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about syntax