title: Difference between prototype function and json notation function?
body: <p>I have created below two employee classes, one using a constructor function and the other with JSON notation. In the constructor function, the <code>print</code> function is created by prototype so only one copy will be kept and objects (<code>emp1</code> and <code>emp2</code>) share this <code>print</code> function. </p>
  
  <p><strong>Question:</strong> In the JSON notation (<code>EmployeeNew</code>), will the <code>print</code> function be held in memory as one copy only? Or will each object keep its own copy? What is the fundamental difference between these two approaches? Which is best for which scenario?</p>
  
  <pre><code>var Employee = function (name) {
      this.name = name;
  };
  
  Employee.prototype.print = function () {
      console.log(this.name);
  }
  
  
  var emp1 = new Employee("jack"),
      emp2 = new Employee("mark");
  
  emp1.print();
  emp2.print();
  
  var EmployeeNew = {
      init: function (name) { this.name = name; },
      print: function () {
          console.log(this.name);
      }
  };
  
  var empNew1 = Object.create(EmployeeNew),
      empNew2 = Object.create(EmployeeNew)
  
  empNew1.init("jack")
  empNew1.print();
  empNew2.init("jack");
  empNew2.print();
  </code></pre>