<!DOCTYPE html>
<html>
<body>
<h1>JavaScript 对象</h1>
<p id="demo"></p>
<script>
function Person(first, last, age, eye) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye;
this.nationality = "English";
}
var myFriend = new Person("Bill", "Gates", 62, "blue");
var myBrother = new Person("Steve", "Jobs", 56, "green");
document.getElementById("demo").innerHTML =
"The nationality of my friend is " + myFriend.nationality + ". The nationality of my brother is " + myBrother.nationality;
</script>
</body>
</html>