crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Object Constructors</h2> <p id="demo"></p> <script> // Constructor function for Person objects function Person(first, last, age, eye) { this.firstName = first; this.lastName = last; this.age = age; this.eyeColor = eye; this.name = function() { return this.firstName + " " + this.lastName }; } // Create a Person object const myFather = new Person("Mahmoud", "adel", 50, "blue"); // Display full name document.getElementById("demo").innerHTML = "My father is " + myFather.name(); </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBPYmplY3QgQ29uc3RydWN0b3JzPC9oMj4NCg0KPHAgaWQ9ImRlbW8iPjwvcD4NCg0KPHNjcmlwdD4NCg0KLy8gQ29uc3RydWN0b3IgZnVuY3Rpb24gZm9yIFBlcnNvbiBvYmplY3RzDQpmdW5jdGlvbiBQZXJzb24oZmlyc3QsIGxhc3QsIGFnZSwgZXllKSB7DQogIHRoaXMuZmlyc3ROYW1lID0gZmlyc3Q7DQogIHRoaXMubGFzdE5hbWUgPSBsYXN0Ow0KICB0aGlzLmFnZSA9IGFnZTsNCiAgdGhpcy5leWVDb2xvciA9IGV5ZTsNCiAgdGhpcy5uYW1lID0gZnVuY3Rpb24oKSB7DQogICAgcmV0dXJuIHRoaXMuZmlyc3ROYW1lICsgIiAiICsgdGhpcy5sYXN0TmFtZQ0KICB9Ow0KfQ0KDQovLyBDcmVhdGUgYSBQZXJzb24gb2JqZWN0DQpjb25zdCBteUZhdGhlciA9IG5ldyBQZXJzb24oIk1haG1vdWQiLCAiYWRlbCIsIDUwLCAiYmx1ZSIpOw0KDQovLyBEaXNwbGF5IGZ1bGwgbmFtZQ0KZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImRlbW8iKS5pbm5lckhUTUwgPQ0KIk15IGZhdGhlciBpcyAiICsgbXlGYXRoZXIubmFtZSgpOyANCg0KPC9zY3JpcHQ+DQoNCjwvYm9keT4NCjwvaHRtbD4=