Attach properties to functions within their definition
<p>I want to achieve the same as this...</p>

<pre><code>var x = function(){ return "abc"}
x.y = 123

x() // "abc"
x.y // 123
</code></pre>

<p>but to define the properties inside the function definition like this...</p>

<pre><code>var x = function(){
    // declare `this.y` here somehow...
    // this.y = 123
    return "abc"
}
</code></pre>
