JavaScript Object Variable Frustration

I have code that is analogous to the following:


function ObjectDefinition(passInValue)
{
     this.var1 = {}; //empty object
     this.var2 = passInValue;
     this.var3 = { "key" : "value" };

     this.myFunction1()
     {
           alert("this.var1 = " + this.var1);
           alert("this.var2 = " + this.var2);
           alert("this.var3 = " + this.var3);
     };
}

When myFunction1() runs, variables 1 and 3 are said to be undefined, and variable 2 IS defined correctly as the value passed into the constructor. I have tried a lot of variations in structuring this class to see if that changes anything, but nothing has helped. I really don’t understand this - its like the scope of var1 and var3 are not making it past the constructor…but somehow var2 with the passed value is?

Any clarification here would be great. I’ve been through some 15 websites explaining class definitions in JavaScript and according to all of them, this should be working.

Thanks.