Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Define the constructor property on the Dog prototype.

function Dog(name) {
  this.name = name;
}
Dog.prototype = {
  constructor: Dog,
  numLegs: 4,
  eat: function() {
    console.log("nom nom nom");
  },
  describe: function() {
    console.log("My name is " + this.name);
  }
};
Source by github.com #
 
PREVIOUS NEXT
Tagged: #Define #constructor #property #Dog
ADD COMMENT
Topic
Name
6+4 =