repl.it
Nodejs

No description

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function Justin (name, age) {
  this.name = this.setName("blah");
  this.age = age
  
}

Justin.prototype.getName = function () {
  return this.name
}

Justin.prototype.getAge = function() {
  return this.age
}

Justin.prototype.setName = function (myName) {
  this.name = myName;
}

var justin = new Justin('Justin', 23)

console.log(justin.getName())
console.log(justin.getAge())
?