class Person { constructor(name) { this.name = name; } } Person.prototype.x = function(){return this.name}; p = new Person("dfrewiop"); console.log(p.x()); } /*Prototype.prototype.x = this.name will not work*/