Passing Argument to JavaScript Object Getter
<pre><code>var URIController = {
    get href() {
        return url.location.href;
    }
}
</code></pre>

<p>I have above object structure. But <code>URIController.href</code> property depends on another object, <code>url</code>. </p>

<p>If the <code>url</code> is defined globally, <code>URIController.href</code> works. But I want to pass <code>url</code> object to <code>href</code> getter manually.</p>

<pre><code>var URIController = {
    get href(url) {
        return url.location.href;
    }
}
</code></pre>

<p>Changed the getter to accept url parameter but </p>

<pre><code>URIController.href(url)
</code></pre>

<p>throws error because href is not a function.</p>

<p>Is it possible to pass arguments to getter in javascript?</p>