Constructors

From rbachwiki
Revision as of 22:16, 20 October 2016 by Bacchas (talk | contribs) (Created page with "<pre> function Person(name, age){ this.name = name; this.age=age; this.display=function(){ console.log("My name is " + name); console.log("My age is "+ age); }...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
function Person(name, age){
  this.name = name;
  this.age=age;
  this.display=function(){
    console.log("My name is " + name);
    console.log("My age is "+ age);
  }
}
var person = new Person("robert",24);
person.display();