crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Objects</h2> <p>The prototype property allows you to add new methods to objects constructors:</p> <p id="demo"></p> <script> function Person(first, last, age, eye) { this.firstName = first; this.lastName = last; this.age = age; this.eyeColor = eye; } Person.prototype.nationality = "English"; const myFather = new Person("Ahmed", "Adel", 50, "blue"); document.getElementById("demo").innerHTML = "The nationality of my father is " + myFather.nationality; </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBPYmplY3RzPC9oMj4NCg0KPHA+VGhlIHByb3RvdHlwZSBwcm9wZXJ0eSBhbGxvd3MgeW91IHRvIGFkZCBuZXcgbWV0aG9kcyB0byBvYmplY3RzIGNvbnN0cnVjdG9yczo8L3A+DQoNCjxwIGlkPSJkZW1vIj48L3A+DQoNCjxzY3JpcHQ+DQpmdW5jdGlvbiBQZXJzb24oZmlyc3QsIGxhc3QsIGFnZSwgZXllKSB7DQogIHRoaXMuZmlyc3ROYW1lID0gZmlyc3Q7DQogIHRoaXMubGFzdE5hbWUgPSBsYXN0Ow0KICB0aGlzLmFnZSA9IGFnZTsNCiAgdGhpcy5leWVDb2xvciA9IGV5ZTsNCn0NCg0KUGVyc29uLnByb3RvdHlwZS5uYXRpb25hbGl0eSA9ICJFbmdsaXNoIjsNCg0KY29uc3QgbXlGYXRoZXIgPSBuZXcgUGVyc29uKCJBaG1lZCIsICJBZGVsIiwgNTAsICJibHVlIik7DQpkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiZGVtbyIpLmlubmVySFRNTCA9DQoiVGhlIG5hdGlvbmFsaXR5IG9mIG15IGZhdGhlciBpcyAiICsgbXlGYXRoZXIubmF0aW9uYWxpdHk7IA0KPC9zY3JpcHQ+DQoNCjwvYm9keT4NCjwvaHRtbD4=