03-Class-Destructing.html
Dosyayı İndir
<html>
<head>
<script>
class Rectangle{
constructor(width,height){
this.width=width;
this.height=height;
}
getArea(){
return this.width*this.height;
}
}
var rectangle=new Rectangle(3,4);
//var width=rectangle.width;
//var height=rectangle.height;
var {width,height}=rectangle;
console.log("Genişlik: "+width+" "
+"Yükseklik: "+height);
var {width:w,height:h}=rectangle;
console.log("Genişlik: "+w+" "
+"Yükseklik: "+h);
</script>
</head>
<body>
<h1> Sınıf Yapısızlama </h1>
</body>
</html>
Dosyayı İndir