"this" in JavaScript
<p>I'm trying to understand the syntax of how to put together a JavaScript function as an object.</p>

<p>Q: Is this the right way to do it?</p>

<p>The reason why I ask is because I'm looking at it in Firebug and I was hoping to be able to drill down and see the value of myVar and myVariable, but instead Firebug only says that "this" is an object Object.</p>

<pre><code>var myObject = {
    init: function() {
        var myVar = 1;
        myObject.myVariable = 2;
        console.log('"this" when called as an object: ' + this);
    }
}
myObject.init();
</code></pre>

<p>Also, what's the funny little syntax to call it directly upon declaration?  Something about (), but when I remove the last line and put () at the end of the declaration, I get a syntax error.</p>
