title: Getting undefined value while inheritance in JavaScript OOPS
body: <p>Getting undefined value while inheritance in JavaScript OOPS. Student object doesn't inheritance the Person Object </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function person(name, age) {
      this.name = name;
      this.age = age;
      this.say = function() {
          return this.name + " says Hi..";
      }
  }
  
  var p1 = new person("Mahesh", "33");
  var p2 = new person("Girish", "30");
  
  console.log(p1.say());
  console.log(p2.say());
  
  // Inheritance 
  function student() {};
  student.prototype = new person();
  var stud1 = new student("Nakktu", "32");
  
  console.log(stud1.say());</code></pre>
  </div>
  </div>
  </p>