学习的时候写的javascript代码

来源:互联网 发布:c语言中int是什么意思 编辑:程序博客网 时间:2024/04/30 23:15

var LeePrototype={
    name:'LeePrototype',
    versoion:0.01,
    describe:'leehong',
    sayHello:function(){alert("Hello,I'm LeePrototype")}
}
alert(LeePrototype.name);

var Person =function(name)
{
    this.name=name;
}

var bencode=new Person("bencode");
alert(bencode.name)

Person.prototype={
    sayHello:function(){
    alert("hi,javaeye,i'm"+this.name);
    }
}

var bencode=new Person("bencode");
bencode.sayHello();

var A= function (){
}

A.prototype={
    sayHello:function(){
   alert("sayHello a")
    }
}

var B=function(){
}
B.prototype=A.prototype;
B.prototype;
var b=new B();
b.sayHello(); 

原创粉丝点击