title: Define getter / setter in object function
body: <p>I'm learning JavaScript, and was wondering if it was possible to define getters and setters in object functions.
  The main difference is the way of calling it, if defined as <code>getFullName = function()</code>, I should call the method as <code>myObj.getFullName()</code>, however, as for arrays, a getter allows for it to be called as a simple property <code>myObj.fullName</code> (without parenthesis).</p>
  
  <p>As I saw in MDN reference (<a href="http://mzl.la/1CIUuIw" rel="noreferrer">http://mzl.la/1CIUuIw</a>), it is easily done in Object Literals:</p>
  
  <pre><code>var obj = {
      get var(){
          return "something";
      }
  }
  </code></pre>
  
  <p>However, I can't do it on object functions like so:</p>
  
  <pre><code>function obj(name, lname){
      this.name = name;
      this.lastName = lname;
  
      get fullName(){
           return this.name + " " + this.lastName;
      }
  }
  </code></pre>
  
  <p>Getting a "Unexpected identifier" error...</p>