04-02-Object-Compose.html
Dosyayı İndir
<html>
<head>
<script>
function Person(firstName,lastName) {
this.firstName = firstName;
this.lastName = lastName;
this.fullName = function() {
return this.firstName + " " + this.lastName;
};
}
function Order(person,salesPrice,salesQuantity) {
this.person = person;
this.salesPrice = salesPrice;
this.salesQuantity = salesQuantity;
this.totalAmount = function() {
return this.salesPrice*this.salesQuantity;
};
this.displayText = function() {
return person.fullName()+" : "+this.totalAmount();
};
}
var myperson=new Person("Muslis","Akarsu");
var myorder=new Order(myperson,1200,3);
alert(myorder.displayText());
</script>
</head>
<body>
<h1>JavaScript Birle�ik Nesneler</h1>
</body>
</html>
Dosyayı İndir