Constructors
Jump to navigation
Jump to search
Constructor
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); } } // create a new Object var person = new Person("robert",24); person.display();