title: use setter/getter to get/update value
body: <p>I have an object with a method <code>path</code>. When the method is executed without parameters, I want it to act like a getter, when with parameter - act like a setter. How can I do that using js getters/setters? This option seems wrong:</p>
  
  <pre><code>var o = {
    get path(p) {
       if (p === undefined) {
          return _path;
       } else {
          return _path=p;
       }
    }
  }
  </code></pre>
  
  <p>If I define an object like that:</p>
  
  <pre><code>var o = {
    get path() {
      return _path;
    }
    set path() {
      _path=p;
    }
  }
  </code></pre>
  
  <p>And then set it like that <code>o.path("some")</code>, the browser (Chrome) executes the getter and then throws <code>o.path is not a function</code></p>