function Demo(name,age){ this.name = name this.age = age this.sing = function(){ console.log(this.name + "唱歌") } } let lx = new Demo(‘张三‘,10) lx.sing()
构造函数--1.创建
原文:https://www.cnblogs.com/ruoxiangli/p/11166966.html