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

Bu Sayfayı Paylaş:




Bu Sayfayı Paylaş:

İletişim Bilgileri

Takip Et

Her Hakkı Saklıdır. Bu sitede yayınlanan tüm bilgi ve fikirlerin kullanımından fibiler.com sorumlu değildir. Bu sitede üretilmiş , derlenmiş içerikleri, fibiler.com'u kaynak göstermek koşuluyla kendi sitenizde kullanılabilirsiniz. Ancak telif hakkı olan içeriklerin hakları sahiplerine aittir