how to add prototype in javascript

JavaScript
function Dog(name) {
  this.name = name;
}



// Only change code above this line
Dog.prototype.numLegs = 2;
let beagle = new Dog("Snoopy");
Source

Also in JavaScript: