crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Objects</h2> <p>You cannot add a new property to a constructor function.</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.nationality = "English"; const myFather = new Person("ahmed", "hatem", 50, "blue"); const myMother = new Person("salah", "saleh", 48, "green"); document.getElementById("demo").innerHTML = "The nationality of my father is " + myFather.nationality; </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBPYmplY3RzPC9oMj4NCg0KPHA+WW91IGNhbm5vdCBhZGQgYSBuZXcgcHJvcGVydHkgdG8gYSBjb25zdHJ1Y3RvciBmdW5jdGlvbi48L3A+DQoNCjxwIGlkPSJkZW1vIj48L3A+DQoNCjxzY3JpcHQ+DQpmdW5jdGlvbiBQZXJzb24oZmlyc3QsIGxhc3QsIGFnZSwgZXllKSB7DQogIHRoaXMuZmlyc3ROYW1lID0gZmlyc3Q7DQogIHRoaXMubGFzdE5hbWUgPSBsYXN0Ow0KICB0aGlzLmFnZSA9IGFnZTsNCiAgdGhpcy5leWVDb2xvciA9IGV5ZTsNCn0NCg0KUGVyc29uLm5hdGlvbmFsaXR5ID0gIkVuZ2xpc2giOw0KDQpjb25zdCBteUZhdGhlciA9IG5ldyBQZXJzb24oImFobWVkIiwgImhhdGVtIiwgNTAsICJibHVlIik7DQpjb25zdCBteU1vdGhlciA9IG5ldyBQZXJzb24oInNhbGFoIiwgInNhbGVoIiwgNDgsICJncmVlbiIpOw0KDQoNCmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJkZW1vIikuaW5uZXJIVE1MID0NCiJUaGUgbmF0aW9uYWxpdHkgb2YgbXkgZmF0aGVyIGlzICIgKyBteUZhdGhlci5uYXRpb25hbGl0eTsgDQo8L3NjcmlwdD4NCg0KPC9ib2R5Pg0KPC9odG1sPg==