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.nationality = "English"; } // Create 2 Person objects const myFather = new Person("Hossam", "Mohamed", 50, "blue"); const myMother = new Person("Sally", "Rally", 48, "green"); // Display nationality document.getElementById("demo").innerHTML = "My father is " + myFather.nationality + ". My mother is " + myMother.nationality; </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBPYmplY3QgQ29uc3RydWN0b3JzPC9oMj4NCg0KPHAgaWQ9ImRlbW8iPjwvcD4NCg0KPHNjcmlwdD4NCg0KLy8gQ29uc3RydWN0b3IgZnVuY3Rpb24gZm9yIFBlcnNvbiBvYmplY3RzDQpmdW5jdGlvbiBQZXJzb24oZmlyc3QsIGxhc3QsIGFnZSwgZXllKSB7DQogIHRoaXMuZmlyc3ROYW1lID0gZmlyc3Q7DQogIHRoaXMubGFzdE5hbWUgPSBsYXN0Ow0KICB0aGlzLmFnZSA9IGFnZTsNCiAgdGhpcy5leWVDb2xvciA9IGV5ZTsNCiAgdGhpcy5uYXRpb25hbGl0eSA9ICJFbmdsaXNoIjsNCn0NCg0KLy8gQ3JlYXRlIDIgUGVyc29uIG9iamVjdHMNCmNvbnN0IG15RmF0aGVyID0gbmV3IFBlcnNvbigiSG9zc2FtIiwgIk1vaGFtZWQiLCA1MCwgImJsdWUiKTsNCmNvbnN0IG15TW90aGVyID0gbmV3IFBlcnNvbigiU2FsbHkiLCAiUmFsbHkiLCA0OCwgImdyZWVuIik7DQoNCi8vIERpc3BsYXkgbmF0aW9uYWxpdHkNCmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJkZW1vIikuaW5uZXJIVE1MID0NCiJNeSBmYXRoZXIgaXMgIiArIG15RmF0aGVyLm5hdGlvbmFsaXR5ICsgIi4gTXkgbW90aGVyIGlzICIgKyBteU1vdGhlci5uYXRpb25hbGl0eTsgDQo8L3NjcmlwdD4NCg0KPC9ib2R5Pg0KPC9odG1sPg==