久久久久久AV无码免费看大片,亚洲一区精品人人爽人人躁,国产成人片无码免费爱线观看,亚洲AV成人无码精品网站,为什么晚上搞的时候要盖被子

ES5中prototype的應(yīng)用

時間:2019-09-12 14:47:56 類型:JS/JQUERY
字號:    

ES5中prototype的應(yīng)用, 在JS中,函數(shù)同時也是一個對象, 向這個函數(shù)對象中添加屬性及函數(shù)可使用prototype這個屬性


<script type="text/javascript">
		function Obj(){
			this.name ="南昌雅騰";
			this.success = function(){
						console.log('成功');
					}
		}
		Obj.prototype.address = "南昌艾溪湖邊上";
		Obj.prototype.getName = function(){
			return this.name;
		}

		var app = new Obj();
		console.log(app.getName());
	</script>