Become a member
Sign in
abc1two3
abc1two3

abc1two3

4 Following
  • Profile
  • Claps

Latest

abc1two3
abc1two3
Sep 24, 2015 · 1 min read

Different Styles to define Javascript “Classes”

Method 1

/* Person class */ 
var Person = function () {};
Person.prototype.setName = function (name) {
this.name = name;
};
Person.prototype.getName = function () {
return this.name;
};

1