学员操作——flower函数

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>flower函数</title>
</head>
<body>
<script>
function Flower(){
}
Flower.prototype.name="小盼";
Flower.prototype.sex="女";
Flower.prototype.age=18;
Flower.prototype.hobby="看书、听歌、看电影、健身、购物等";
Flower.prototype.showName=function() {
alert(this.name);
}
var flower1=new Flower();
flower1.showName();
var flower2=new Flower();
flower2.showName();
alert(flower1.showName==flower2.showName);
</script>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/pan520/p/13175948.html