html5

Function.prototype.myFunc = function(){
            console.log(2222222222);
        }
        Object.prototype.myFunc = function(){
            console.log(2222222222);
        }
        静态成员只有自己含有

ldh.myFun();
        console.log(ldh.name);
        console.log(ldh.__proto__.constructor.sex);
        ldh.__proto__.sumFun();
        ldh.__proto__.constructor.sumFun();
        
        console.log(ldh);
        constructor静态方法
        console.log(Star.prototype.constructor.sex);
        console.log(ldh.__proto__.constructor.sex);
        var xyz=new Star('周润发',20);
        console.log(Star.prototype.sex);
        console.log(Star.sex);
        console.log(Star.prototype);
        console.log(ldh.__proto__.sex);
        console.log(ldh.sex);
        ldh.__proto__.sumFun();
        ldh.sumFun();
        ldh.myFunc();
        Star.myFunc();
        
        
        Star("朱攀佳",3)
        function func(){
            console.log(this.name);
            sing();
        }
        func();
        var ldh=new Star('刘德华',18);
        console.log(typeof ldh);
        console.log(ldh);
        ldh.sing();
        ldh.name = "陈冬";
        console.log(ldh);
        Star.sex = "男";
        console.log(Star.sex);

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
	<script type="text/javascript">
		// 原型
		function Star(name,age){
			this.name=name;
			this.age=age;
			this.sing=function(){
				console.log('唱歌')
			}
		}
		// Function.prototype.myFunc = function(){
		// 	console.log(2222222222);
		// }
		// Object.prototype.myFunc = function(){
		// 	console.log(2222222222);
		// }
		// 静态成员只有自己含有
		Star.sex = "女";
		Star.prototype.sex = "男";
		Star.prototype.sumFun = function(){
			console.log(1111111111);
		}
		Object.prototype.myFun = function(){
			console.log(2222222222);
		}
		var ldh=new Star('刘德华',18);
		
		// ldh.myFun();
		// console.log(ldh.name);
		// console.log(ldh.__proto__.constructor.sex);
		// ldh.__proto__.sumFun();
		// ldh.__proto__.constructor.sumFun();
		
		// console.log(ldh);
		// constructor静态方法
		// console.log(Star.prototype.constructor.sex);
		// console.log(ldh.__proto__.constructor.sex);
		// var xyz=new Star('周润发',20);
		// console.log(Star.prototype.sex);
		// console.log(Star.sex);
		// console.log(Star.prototype);
		// console.log(ldh.__proto__.sex);
		// console.log(ldh.sex);
		// ldh.__proto__.sumFun();
		// ldh.sumFun();
		// ldh.myFunc();
		// Star.myFunc();
		
		
		// Star("朱攀佳",3)
		// function func(){
		// 	console.log(this.name);
		// 	sing();
		// }
		// func();
		// var ldh=new Star('刘德华',18);
		// console.log(typeof ldh);
		// console.log(ldh);
		// ldh.sing();
		// ldh.name = "陈冬";
		// console.log(ldh);
		// Star.sex = "男";
		// console.log(Star.sex);
	</script>
</html>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值