title: JavaScript add method to constructor function
body: <p>Why can't I do the following?</p>
  
  <pre><code>function Person(name) {
    this.name = name;
    this.sayHello = function() {
      console.log("Hi, my name is " + this.name);
    };
  }
  
  var me = new Person("Robert");
  me.sayHello();
  </code></pre>
  
  <p>Output: <code>Uncaught TypeError: me.sayHello is not a function(anonymous function) @ index.html:20</code></p>