`

javascript对象的各种方法

阅读更多
function asd(){
 this.cc=function(){
  alert('ccc');
 };
 
 function privat(){
  alert('私有方法');
 }
 privat();
 
};
asd.dd=function(){
  alert('dd');
 };
 asd.prototype={
 aa : 'aa',
 bb : function(){
  alert(this.aa);
 }
 
};
//asd.prototype.bb();
var sub=new asd();
sub.bb();  // 继承的父对象的prototype的方法
sub.cc();  // 公有方法
asd.dd();   //静态方法 ^_^
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics