构造函数--1.创建

function Demo(name,age){
this.name = name
this.age = age
this.sing = function(){
console.log(this.name + "唱歌")
}
}
let lx = new Demo('张三',10)
lx.sing()

 

posted @ 2019-07-10 22:16  流年碎  阅读(133)  评论(0编辑  收藏  举报