qq_40547717
花菜的棉花糖
2021-03-07 16:49

js constructor 属性详解

 Person.prototype={
                      constructor:Person,//告诉我们当前对象是由那个对象产生的
                      LEGS:2,
                      sayHi:function(){
console.log('Hello, I am ' + this.name+ ', I am '+this.age+' years old, and '+'I have '+this.LEGS+' legs') },
                      showName:function(){
        console.log('I am '+this.name);
                     },
                      showAge:function(){
        console.log('I am '+this.age + ' years old');
                     }
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

为你推荐