Defining an OOP structure for a Student class in NodeJS
In modern versions of node.js (v6.0 or v4.x in strict mode) or when using an ES6 transpiler, you can use the ES6 class keyword:

class Student {
    constructor(name, age, id) {
        // always initialize all instance properties
        this.name = name;
        this.age = age;
        this.id = id;
    }
    getStudentName() {
        return this.name;
    }
    getStudentAge() {
        return this.age;
    }
    getStudentId() {
        return this.id;
    }
}


This creates the same underlying .prototype methods as your original code, but is obviously a bit cleaner syntax.  Usage of the Student constructor and methods is identical.



Note: You don't need accessor methods for these properties.  They are directly accessible as properties of the object.

If you don't want them directly accessible as properties (e.g. you only want methods to be able to access them), you can do this:

function Student(name, age, id) {
   this.getStudentName = function() {
       return name;
   }
   this.getStudentAge = function() {
       return age;
   }
   this.getStudentID = function() {
       return id;
   }
}


This "hides" the name, age and id instance variables in a constructor closure so they are only accessible to methods defined within the constructor.  This does not use the prototype for methods and may (depending upon JS implementation) consume a bit more memory per object, but does give you property privacy.