热门

最新

红包

立Flag

投票

同城

我的

发布
m0_51349355
风瑞千行
4 年前
truem0_51349355

原型链
//父类
function people(name,age,color){
this.name=name
this.age=age
this.color
}
people.prototype.move=function(){
console.log(this.name+"正在工作")
}
//子类
function student(name,age,color){

}
student.prototype=new people("王一",18,"黑色");
student.prototype.mystudents=function(){
console.log("学习")
}
var s1=new student()
s1.move()
s1.mystudents()

CSDN App 扫码分享
分享
评论
7
打赏
  • 复制链接
  • 举报
下一条:
电子技术基础的,谁会呀
立即登录